Andrei Kulakov <andrei....@gmail.com> added the comment:
This is kind of interesting: - The unit test was wrong, it was catching the wrong OSError. (I was catching regex first but after some tweaking and changes I lost it and forgot to readd) - The reason it was passing is exactly what you pointed out -- the __main__.py in `unittest` package. After I change the class' module to __main__ in the test, it starts looking at sys.modules['__main__'] which is the one in unittest, which doesn't have this class, which causes the inspect to throw another OSError. - I fixed the unit test by both checking for error regex and patching sys.modules['__main__'] (and of course restoring it later). Thanks for helping to catch this :-) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44648> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com