diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-03-04 00:30:25 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-03-04 00:30:25 (GMT) |
commit | 243bff4708542a64c1e79555c509008d073d6f8c (patch) | |
tree | 34f2e8a9bd0e54506667bfb2919b641ca2cdb8d7 /Lib/test/test_inspect.py | |
parent | 0c8f6643c6eb0de2c4f3fdab86787ebc5e0b3f81 (diff) | |
download | cpython-243bff4708542a64c1e79555c509008d073d6f8c.zip cpython-243bff4708542a64c1e79555c509008d073d6f8c.tar.gz cpython-243bff4708542a64c1e79555c509008d073d6f8c.tar.bz2 |
Clean up junk files left behind by imp.load_source().
Diffstat (limited to 'Lib/test/test_inspect.py')
-rw-r--r-- | Lib/test/test_inspect.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_inspect.py b/Lib/test/test_inspect.py index 74e6326..fd4f12b 100644 --- a/Lib/test/test_inspect.py +++ b/Lib/test/test_inspect.py @@ -75,7 +75,9 @@ file = open(TESTFN, 'w') file.write(source) file.close() +# Note that load_source creates file TESTFN+'c' or TESTFN+'o'. mod = imp.load_source('testmod', TESTFN) +files_to_clean_up = [TESTFN, TESTFN + 'c', TESTFN + 'o'] def istest(func, exp): obj = eval(exp) @@ -204,4 +206,8 @@ test(inspect.formatargvalues(args, varargs, varkw, locals) == '(a=7, b=8, c=9, d=3, (e=4, (f=5,)), *g=(), **h={})', 'mod.fr.f_back formatted argvalues') -os.unlink(TESTFN) +for fname in files_to_clean_up: + try: + os.unlink(fname) + except: + pass |