diff options
Diffstat (limited to 'Lib/importlib/test')
-rw-r--r-- | Lib/importlib/test/import_/test_path.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/importlib/test/import_/test_path.py b/Lib/importlib/test/import_/test_path.py index 2faa231..b28f25d 100644 --- a/Lib/importlib/test/import_/test_path.py +++ b/Lib/importlib/test/import_/test_path.py @@ -73,6 +73,16 @@ class FinderTests(unittest.TestCase): loader = machinery.PathFinder.find_module(module) self.assertTrue(loader is importer) + def test_path_importer_cache_empty_string(self): + # The empty string should create a finder using the cwd. + path = '' + module = '<test module>' + importer = util.mock_modules(module) + hook = import_util.mock_path_hook(os.getcwd(), importer=importer) + with util.import_state(path=[path], path_hooks=[hook]): + loader = machinery.PathFinder.find_module(module) + self.assertIs(loader, importer) + self.assertIn('', sys.path_importer_cache) class DefaultPathFinderTests(unittest.TestCase): |