bpo-37421: Fix test_distutils.test_build_ext() (GH-14564)

test_distutils.test_build_ext() is now able to remove the temporary
directory on Windows: don't import the newly built C extension ("xx")
in the current process, but test it in a separated process.
This commit is contained in:
Victor Stinner 2019-07-03 11:12:27 +02:00 committed by GitHub
parent 684cb47fff
commit 74c9dd5777
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 23 deletions

View file

@ -6,6 +6,7 @@ import tempfile
import unittest
import sysconfig
from copy import deepcopy
import test.support
from distutils import log
from distutils.log import DEBUG, INFO, WARN, ERROR, FATAL
@ -64,8 +65,8 @@ class TempdirManager(object):
os.chdir(self.old_cwd)
super().tearDown()
while self.tempdirs:
d = self.tempdirs.pop()
shutil.rmtree(d, os.name in ('nt', 'cygwin'))
tmpdir = self.tempdirs.pop()
test.support.rmtree(tmpdir)
def mkdtemp(self):
"""Create a temporary directory that will be cleaned up.