diff options
| author | Nick Coghlan <ncoghlan@gmail.com> | 2012-07-31 11:14:18 (GMT) |
|---|---|---|
| committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-07-31 11:14:18 (GMT) |
| commit | 42c0766a53d88756158cd0157faa7c8560c70c3b (patch) | |
| tree | 8ae8a41fd61a3f24afa68d7331566b23f782f70e /Lib/test/test_import.py | |
| parent | 73a74dad3fe4ff69cdb1ecce73484c1574f93256 (diff) | |
| download | cpython-42c0766a53d88756158cd0157faa7c8560c70c3b.zip cpython-42c0766a53d88756158cd0157faa7c8560c70c3b.tar.gz cpython-42c0766a53d88756158cd0157faa7c8560c70c3b.tar.bz2 | |
Close #15486: Simplify the mechanism used to remove importlib frames from tracebacks when they just introduce irrelevant noise
Diffstat (limited to 'Lib/test/test_import.py')
| -rw-r--r-- | Lib/test/test_import.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/test/test_import.py b/Lib/test/test_import.py index 3e61577..7089328 100644 --- a/Lib/test/test_import.py +++ b/Lib/test/test_import.py @@ -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 = [] |
