diff options
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r-- | Lib/test/test_import.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 760713e..d8f2d51 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -221,6 +221,16 @@ class ImportTest(unittest.TestCase): del sys.modules[TESTFN] + def test_importbyfilename(self): + path = os.path.abspath(TESTFN) + try: + __import__(path) + except ImportError as err: + self.assertEqual("Import by filename is not supported.", + err.args[0]) + else: + self.fail("import by path didn't raise an exception") + class PathsTests(unittest.TestCase): SAMPLES = ('test', 'test\u00e4\u00f6\u00fc\u00df', 'test\u00e9\u00e8', 'test\u00b0\u00b3\u00b2') |