micropython-lib
micropython-lib copied to clipboard
unittest: fix context manager to store exception for later retrieval
The statement "with assertRaises(errtype) as ctxt" checks the type of a raised exception, but did not store the exception into ctxt like unittest of CPython. The exception instance is usually used to check its message or other args.
This commit is a one-line fix at the cost of a bit more RAM usage while running unittests.