Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
The test is same as below and given that __spec__ an __name__ are passed as None where ImportWarning is raised in Lib/importlib/_bootstrap.py 1074 . can we just use self.assertWarns(ImportWarning) in the test? >>> __import__('', {'__package__': None, '__spec__': None, '__name__': >>> '__main__'}, locals={}, fromlist=('foo',), level=1) <stdin>:1: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__ Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: attempted relative import with no known parent package ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue37409> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com