FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-127651: Use __file__ in diagnostics if origin is missing by hauntsaninja · Pull Request #127660 · python/cpython · GitHub

Repository navigation

Prev Previous commit
Next Next commit
remove tmp dir
  • Loading branch information
hauntsaninja committed Dec 9, 2024
commit 247565e3031cd3938d43bac118592a0929903d02
7 changes: 2 additions & 5 deletions Lib/test/test_import/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -831,15 +831,12 @@ def test_frozen_module_from_import_error(self):
"""
]
for script in scripts:
with self.subTest(script=script), os_helper.temp_dir() as tmp:
with open(os.path.join(tmp, "main.py"), "w", encoding='utf-8') as f:
f.write(script)

with self.subTest(script=script):
expected_error = (
b"cannot import name 'this_will_never_exist' "
b"from 'os' \\(unknown location\\)"
)
popen = script_helper.spawn_python(os.path.join(tmp, "main.py"), cwd=tmp)
popen = script_helper.spawn_python("-c", script)
stdout, stderr = popen.communicate()
self.assertRegex(stdout, expected_error)

Expand Down

Back | FazBrowse Home | New Git URL