summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-01-09 19:56:33 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-01-09 19:56:33 (GMT)
commit3403f1589d769a5596dfc261a9cab31b307fb059 (patch)
tree9e24a9ae128fda398b29cc839f05ae45a98d12ac /Lib/test/test_import.py
parent195b883bb47a392ea8b92dccbca30ffcf1adecd3 (diff)
downloadcpython-3403f1589d769a5596dfc261a9cab31b307fb059.zip
cpython-3403f1589d769a5596dfc261a9cab31b307fb059.tar.gz
cpython-3403f1589d769a5596dfc261a9cab31b307fb059.tar.bz2
Fixed #1776. __import__() no longer imports modules by file name
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r--Lib/test/test_import.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 9c44b87..a44170c 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -1,4 +1,4 @@
-from test.test_support import TESTFN, run_unittest, catch_warning
+from test.test_support import TESTFN, run_unittest, catch_warning
import unittest
import os
@@ -223,6 +223,16 @@ class ImportTest(unittest.TestCase):
warnings.simplefilter('error', ImportWarning)
self.assertRaises(ImportWarning, __import__, "site-packages")
+ def test_importbyfilename(self):
+ path = os.path.abspath(TESTFN)
+ try:
+ __import__(path)
+ except ImportError, 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):
path = TESTFN