Commit 6407a3bc authored by Tim Peters's avatar Tim Peters

Clean up junk files left behind by imp.load_source().

parent 7f97a7be
......@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment