Skip to content

Commit 0cea35b

Browse files
committed
subtest from alex
1 parent 336a722 commit 0cea35b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Lib/test/test_import/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ def test_script_shadowing_stdlib(self):
815815
)
816816
]
817817
for script, error in script_errors:
818-
with os_helper.temp_dir() as tmp:
818+
with self.subTest(script=script), os_helper.temp_dir() as tmp:
819819
with open(os.path.join(tmp, "fractions.py"), "w", encoding='utf-8') as f:
820820
f.write(script)
821821

@@ -870,7 +870,7 @@ def test_package_shadowing_stdlib_module(self):
870870
)
871871
]
872872
for script, error in script_errors:
873-
with os_helper.temp_dir() as tmp:
873+
with self.subTest(script=script), os_helper.temp_dir() as tmp:
874874
os.mkdir(os.path.join(tmp, "fractions"))
875875
with open(
876876
os.path.join(tmp, "fractions", "__init__.py"), "w", encoding='utf-8'
@@ -910,8 +910,8 @@ def test_script_shadowing_third_party(self):
910910
rb"ImportError: cannot import name 'array' from 'numpy'"
911911
)
912912
]
913-
with os_helper.temp_dir() as tmp:
914-
for script, error in script_errors:
913+
for script, error in script_errors:
914+
with self.subTest(script=script), os_helper.temp_dir() as tmp:
915915
with open(os.path.join(tmp, "numpy.py"), "w", encoding='utf-8') as f:
916916
f.write(script)
917917

@@ -1113,7 +1113,7 @@ def test_script_shadowing_stdlib_sys_path_modification(self):
11131113
)
11141114
]
11151115
for script, error in script_errors:
1116-
with os_helper.temp_dir() as tmp:
1116+
with self.subTest(script=script), os_helper.temp_dir() as tmp:
11171117
with open(os.path.join(tmp, "fractions.py"), "w", encoding='utf-8') as f:
11181118
f.write("shadowing_module = True")
11191119
with open(os.path.join(tmp, "main.py"), "w", encoding='utf-8') as f:

0 commit comments

Comments
 (0)