diff options
author | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-20 21:42:00 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@haypocalc.com> | 2010-05-20 21:42:00 (GMT) |
commit | d656354dddf36a159d71b01a77649088f6411e05 (patch) | |
tree | ca8baa03fc3158611a7e5b56cf0494176ed2240d /Lib/test/test_warnings.py | |
parent | 148051a054e2e575c8c908d32ff5d49cbb12e512 (diff) | |
download | cpython-d656354dddf36a159d71b01a77649088f6411e05.zip cpython-d656354dddf36a159d71b01a77649088f6411e05.tar.gz cpython-d656354dddf36a159d71b01a77649088f6411e05.tar.bz2 |
Fix test_warnings on Windows (don't change current directory)
Diffstat (limited to 'Lib/test/test_warnings.py')
-rw-r--r-- | Lib/test/test_warnings.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py index 5cf1034..85b5cad 100644 --- a/Lib/test/test_warnings.py +++ b/Lib/test/test_warnings.py @@ -4,7 +4,6 @@ import os from io import StringIO import sys import unittest -import shutil import tempfile import subprocess from test import support @@ -678,12 +677,11 @@ class BootstrapTest(unittest.TestCase): # "import encodings" emits a warning whereas the warnings is not loaded # or not completly loaded (warnings imports indirectly encodings by # importing linecache) yet - old_cwd = os.getcwd() + cwd = tempfile.mkdtemp() try: - cwd = tempfile.mkdtemp() + encodings = os.path.join(cwd, 'encodings') + os.mkdir(encodings) try: - os.chdir(cwd) - os.mkdir('encodings') env = os.environ.copy() env['PYTHONPATH'] = cwd @@ -697,9 +695,9 @@ class BootstrapTest(unittest.TestCase): env=env) self.assertEqual(retcode, 0) finally: - shutil.rmtree(cwd) + os.rmdir(encodings) finally: - os.chdir(old_cwd) + os.rmdir(cwd) def test_main(): py_warnings.onceregistry.clear() |