diff options
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index a72b8bd..effba3c 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -205,3 +205,20 @@ def test_import_name_binding(): assert y is test.test_support, y.__name__ test_import_name_binding() + +def test_import_initless_directory_warning(): + import warnings + oldfilters = warnings.filters[:] + warnings.simplefilter('error', ImportWarning); + try: + # Just a random non-package directory we always expect to be + # somewhere in sys.path... + __import__("site-packages") + except ImportWarning: + pass + else: + raise AssertionError + finally: + warnings.filters = oldfilters + +test_import_initless_directory_warning() |