diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_pkg.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/test/test_pkg.py b/Lib/test/test_pkg.py index 7dec2e9..36ea95c 100644 --- a/Lib/test/test_pkg.py +++ b/Lib/test/test_pkg.py @@ -56,18 +56,19 @@ def runtest(hier, code): root = tempfile.mkdtemp() mkhier(root, hier) savepath = sys.path[:] - codefile = tempfile.NamedTemporaryFile() - codefile.write(code) - codefile.flush() + fd, fname = tempfile.mkstemp(binary=False) + os.write(fd, code) + os.close(fd) try: sys.path.insert(0, root) if verbose: print "sys.path =", sys.path try: - execfile(codefile.name, globals(), {}) + execfile(fname, globals(), {}) except: traceback.print_exc(file=sys.stdout) finally: sys.path[:] = savepath + os.unlink(fname) try: cleanout(root) except (os.error, IOError): |