mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #19712: Update test.test_importlib.source for PEP 451
This commit is contained in:
parent
86aae6a7b3
commit
2f8c83568c
4 changed files with 140 additions and 24 deletions
|
@ -46,9 +46,6 @@ class FinderTests(abc.FinderTests):
|
|||
self.machinery.BYTECODE_SUFFIXES)]
|
||||
return self.machinery.FileFinder(root, *loader_details)
|
||||
|
||||
def import_(self, root, module):
|
||||
return self.get_finder(root).find_module(module)
|
||||
|
||||
def run_test(self, test, create=None, *, compile_=None, unlink=None):
|
||||
"""Test the finding of 'test' with the creation of modules listed in
|
||||
'create'.
|
||||
|
@ -182,7 +179,23 @@ class FinderTests(abc.FinderTests):
|
|||
finder = self.get_finder(file_obj.name)
|
||||
self.assertEqual((None, []), finder.find_loader('doesnotexist'))
|
||||
|
||||
Frozen_FinderTests, Source_FinderTests = util.test_both(FinderTests, machinery=machinery)
|
||||
class FinderTestsPEP451(FinderTests):
|
||||
|
||||
def import_(self, root, module):
|
||||
found = self.get_finder(root).find_spec(module)
|
||||
return found.loader if found is not None else found
|
||||
|
||||
Frozen_FinderTestsPEP451, Source_FinderTestsPEP451 = util.test_both(
|
||||
FinderTestsPEP451, machinery=machinery)
|
||||
|
||||
|
||||
class FinderTestsPEP302(FinderTests):
|
||||
|
||||
def import_(self, root, module):
|
||||
return self.get_finder(root).find_module(module)
|
||||
|
||||
Frozen_FinderTestsPEP302, Source_FinderTestsPEP302 = util.test_both(
|
||||
FinderTestsPEP302, machinery=machinery)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue