mirror of
https://github.com/python/cpython.git
synced 2025-10-24 02:13:49 +00:00
Issue #19721: Consolidate test_importlib utility code into a single
module.
This commit is contained in:
parent
91795c8e34
commit
732ac654c8
25 changed files with 249 additions and 270 deletions
|
|
@ -1,5 +1,4 @@
|
|||
from .. import util
|
||||
from . import util as source_util
|
||||
|
||||
machinery = util.import_importlib('importlib.machinery')
|
||||
|
||||
|
|
@ -37,7 +36,7 @@ class EncodingTest:
|
|||
module_name = '_temp'
|
||||
|
||||
def run_test(self, source):
|
||||
with source_util.create_modules(self.module_name) as mapping:
|
||||
with util.create_modules(self.module_name) as mapping:
|
||||
with open(mapping[self.module_name], 'wb') as file:
|
||||
file.write(source)
|
||||
loader = self.machinery.SourceFileLoader(self.module_name,
|
||||
|
|
@ -120,7 +119,7 @@ def run_test(self, line_ending):
|
|||
module_name = '_temp'
|
||||
source_lines = [b"a = 42", b"b = -13", b'']
|
||||
source = line_ending.join(source_lines)
|
||||
with source_util.create_modules(module_name) as mapping:
|
||||
with util.create_modules(module_name) as mapping:
|
||||
with open(mapping[module_name], 'wb') as file:
|
||||
file.write(source)
|
||||
loader = self.machinery.SourceFileLoader(module_name,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue