diff options
author | Brett Cannon <brett@python.org> | 2013-11-08 19:25:37 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-11-08 19:25:37 (GMT) |
commit | 9ea8eda127b824f9cffb64deadbb420244a301c2 (patch) | |
tree | 4d5d779c6053a533f2e11b45d1378cdcc208dd2c /Lib/test/test_importlib/source/test_path_hook.py | |
parent | 3a4586a9f97c997fbdb0de297ed75374015e69bf (diff) | |
download | cpython-9ea8eda127b824f9cffb64deadbb420244a301c2.zip cpython-9ea8eda127b824f9cffb64deadbb420244a301c2.tar.gz cpython-9ea8eda127b824f9cffb64deadbb420244a301c2.tar.bz2 |
Issue #16803: test.test_importlib.source now tests frozen and source code
Diffstat (limited to 'Lib/test/test_importlib/source/test_path_hook.py')
-rw-r--r-- | Lib/test/test_importlib/source/test_path_hook.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Lib/test/test_importlib/source/test_path_hook.py b/Lib/test/test_importlib/source/test_path_hook.py index d320f8e..92da772 100644 --- a/Lib/test/test_importlib/source/test_path_hook.py +++ b/Lib/test/test_importlib/source/test_path_hook.py @@ -1,16 +1,18 @@ +from .. import util from . import util as source_util -from importlib import machinery +machinery = util.import_importlib('importlib.machinery') + import unittest -class PathHookTest(unittest.TestCase): +class PathHookTest: """Test the path hook for source.""" def path_hook(self): - return machinery.FileFinder.path_hook((machinery.SourceFileLoader, - machinery.SOURCE_SUFFIXES)) + return self.machinery.FileFinder.path_hook((self.machinery.SourceFileLoader, + self.machinery.SOURCE_SUFFIXES)) def test_success(self): with source_util.create_modules('dummy') as mapping: @@ -21,11 +23,8 @@ class PathHookTest(unittest.TestCase): # The empty string represents the cwd. self.assertTrue(hasattr(self.path_hook()(''), 'find_module')) - -def test_main(): - from test.support import run_unittest - run_unittest(PathHookTest) +Frozen_PathHookTest, Source_PathHooktest = util.test_both(PathHookTest, machinery=machinery) if __name__ == '__main__': - test_main() + unittest.main() |