summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-05-02 14:26:04 (GMT)
committerGitHub <noreply@github.com>2017-05-02 14:26:04 (GMT)
commit3ceeb84b5a90e327ef55190105e82c926b0b8aab (patch)
treecbc27f86b6a06094591be28ff7c1d6fab51f51bc
parent092f4602c329e23b863692249cc630a3eba5b6b5 (diff)
downloadcpython-3ceeb84b5a90e327ef55190105e82c926b0b8aab.zip
cpython-3ceeb84b5a90e327ef55190105e82c926b0b8aab.tar.gz
cpython-3ceeb84b5a90e327ef55190105e82c926b0b8aab.tar.bz2
bpo-30132: distutils BuildExtTestCase use temp_cwd (#1387) (#1388)
BuildExtTestCase of test_distutils now uses support.temp_cwd() in setUp() to remove files created in the current working in all BuildExtTestCase unit tests, not only test_build_ext(). Fix the following warning: Warning -- files was modified by test_distutils Before: [] After: ['vc140.pdb'] (cherry picked from commit 30768958490c658fba0fe24f1cabbdad44be22ff)
-rw-r--r--Lib/distutils/tests/test_build_ext.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/distutils/tests/test_build_ext.py b/Lib/distutils/tests/test_build_ext.py
index f3df564..ce13227 100644
--- a/Lib/distutils/tests/test_build_ext.py
+++ b/Lib/distutils/tests/test_build_ext.py
@@ -37,6 +37,13 @@ class BuildExtTestCase(TempdirManager,
from distutils.command import build_ext
build_ext.USER_BASE = site.USER_BASE
+ # bpo-30132: On Windows, a .pdb file may be created in the current
+ # working directory. Create a temporary working directory to cleanup
+ # everything at the end of the test.
+ self.temp_cwd = support.temp_cwd()
+ self.temp_cwd.__enter__()
+ self.addCleanup(self.temp_cwd.__exit__, None, None, None)
+
def build_ext(self, *args, **kwargs):
return build_ext(*args, **kwargs)