diff options
author | Gregory P. Smith <greg@krypto.org> | 2011-03-15 06:04:11 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2011-03-15 06:04:11 (GMT) |
commit | 81ce68597c0232d7c716c20c662dd0a70fdf31db (patch) | |
tree | bcf085a2aaef4b99e0257f87973d126ab0340db9 | |
parent | 42da663e6fe7ecbb89b17d596c76812a91bb99a4 (diff) | |
download | cpython-81ce68597c0232d7c716c20c662dd0a70fdf31db.zip cpython-81ce68597c0232d7c716c20c662dd0a70fdf31db.tar.gz cpython-81ce68597c0232d7c716c20c662dd0a70fdf31db.tar.bz2 |
Fix the @test_NNNN_tmp file terds being left in whatever your $PWD was
when test_subprocess was run.
-rw-r--r-- | Lib/test/test_subprocess.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py index d7db802..c2a808c00 100644 --- a/Lib/test/test_subprocess.py +++ b/Lib/test/test_subprocess.py @@ -8,6 +8,7 @@ import errno import tempfile import time import re +import shutil mswindows = (sys.platform == "win32") @@ -450,11 +451,12 @@ class ProcessTestCase(BaseTestCase): else: max_handles = 2050 # too much for (at least some) Windows setups handles = [] + tmpdir = tempfile.mkdtemp() try: for i in range(max_handles): try: - handles.append(os.open(support.TESTFN, - os.O_WRONLY | os.O_CREAT)) + tmpfile = os.path.join(tmpdir, support.TESTFN) + handles.append(os.open(tmpfile, os.O_WRONLY|os.O_CREAT)) except OSError as e: if e.errno != errno.EMFILE: raise @@ -479,6 +481,7 @@ class ProcessTestCase(BaseTestCase): finally: for h in handles: os.close(h) + shutil.rmtree(tmpdir) def test_list2cmdline(self): self.assertEqual(subprocess.list2cmdline(['a b c', 'd', 'e']), |