mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Close #15486: Simplify the mechanism used to remove importlib frames from tracebacks when they just introduce irrelevant noise
This commit is contained in:
parent
73a74dad3f
commit
42c0766a53
4 changed files with 3503 additions and 3616 deletions
|
@ -785,11 +785,13 @@ class ImportTracebackTests(unittest.TestCase):
|
|||
sys.path[:] = self.old_path
|
||||
rmtree(TESTFN)
|
||||
|
||||
def create_module(self, mod, contents):
|
||||
with open(os.path.join(TESTFN, mod + ".py"), "w") as f:
|
||||
def create_module(self, mod, contents, ext=".py"):
|
||||
fname = os.path.join(TESTFN, mod + ext)
|
||||
with open(fname, "w") as f:
|
||||
f.write(contents)
|
||||
self.addCleanup(unload, mod)
|
||||
importlib.invalidate_caches()
|
||||
return fname
|
||||
|
||||
def assert_traceback(self, tb, files):
|
||||
deduped_files = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue