summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_import.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2010-07-23 14:03:16 (GMT)
committerBrett Cannon <bcannon@gmail.com>2010-07-23 14:03:16 (GMT)
commit1f27479e26f212b0f2b1f75f17b4ce6f7849ce5b (patch)
tree4a703b5db2f508eeaea9d8ce5fd7941ea77ce92e /Lib/test/test_import.py
parentcfae36fa8e550ecbe9b270da5ace9306d09245e4 (diff)
downloadcpython-1f27479e26f212b0f2b1f75f17b4ce6f7849ce5b.zip
cpython-1f27479e26f212b0f2b1f75f17b4ce6f7849ce5b.tar.gz
cpython-1f27479e26f212b0f2b1f75f17b4ce6f7849ce5b.tar.bz2
Explicitly test relative imports by reusing importlib tests.
Closes issue 8392. Thanks Virgil Dupras for the initial patch.
Diffstat (limited to 'Lib/test/test_import.py')
-rw-r--r--Lib/test/test_import.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py
index 929caa6..be82b22 100644
--- a/Lib/test/test_import.py
+++ b/Lib/test/test_import.py
@@ -1,6 +1,8 @@
import builtins
import errno
import imp
+from importlib.test.import_ import test_relative_imports
+from importlib.test.import_ import util as importlib_util
import marshal
import os
import py_compile
@@ -633,10 +635,21 @@ class PycacheTests(unittest.TestCase):
os.path.join(os.curdir, foo_pyc))
+class RelativeImportTests(test_relative_imports.RelativeImports):
+
+ def setUp(self):
+ self._importlib_util_flag = importlib_util.using___import__
+ importlib_util.using___import__ = True
+
+ def tearDown(self):
+ importlib_util.using___import__ = self._importlib_util_flag
+
+
def test_main(verbose=None):
run_unittest(ImportTests, PycacheTests,
PycRewritingTests, PathsTests, RelativeImportTests,
- OverridingImportBuiltinTests)
+ OverridingImportBuiltinTests,
+ RelativeImportTests)
if __name__ == '__main__':