summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDong-hee Na <donghee.na@python.org>2021-06-12 22:07:24 (GMT)
committerGitHub <noreply@github.com>2021-06-12 22:07:24 (GMT)
commit736ed6f7a9f465ba728198e8bca81e5fbe71bc37 (patch)
treef62d77e50d870b38876b8c0cb36e70a05346f56a
parentcb7230c7a7d6d497e54c25e9ba640eec79de10f2 (diff)
downloadcpython-736ed6f7a9f465ba728198e8bca81e5fbe71bc37.zip
cpython-736ed6f7a9f465ba728198e8bca81e5fbe71bc37.tar.gz
cpython-736ed6f7a9f465ba728198e8bca81e5fbe71bc37.tar.bz2
bpo-43425: Update test_c_parser not to use TempdirManager (GH-26693)
-rw-r--r--Lib/test/test_peg_generator/test_c_parser.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/Lib/test/test_peg_generator/test_c_parser.py b/Lib/test/test_peg_generator/test_c_parser.py
index 3852cfb..013b3af 100644
--- a/Lib/test/test_peg_generator/test_c_parser.py
+++ b/Lib/test/test_peg_generator/test_c_parser.py
@@ -1,7 +1,9 @@
import sysconfig
import textwrap
import unittest
-from distutils.tests.support import TempdirManager
+import os
+import shutil
+import tempfile
from pathlib import Path
from test import test_tools
@@ -68,20 +70,21 @@ unittest.main()
"""
-class TestCParser(TempdirManager, unittest.TestCase):
+class TestCParser(unittest.TestCase):
def setUp(self):
self._backup_config_vars = dict(sysconfig._CONFIG_VARS)
cmd = support.missing_compiler_executable()
if cmd is not None:
self.skipTest("The %r command is not found" % cmd)
- super(TestCParser, self).setUp()
- self.tmp_path = self.mkdtemp()
+ self.old_cwd = os.getcwd()
+ self.tmp_path = tempfile.mkdtemp()
change_cwd = os_helper.change_cwd(self.tmp_path)
change_cwd.__enter__()
self.addCleanup(change_cwd.__exit__, None, None, None)
def tearDown(self):
- super(TestCParser, self).tearDown()
+ os.chdir(self.old_cwd)
+ shutil.rmtree(self.tmp_path)
sysconfig._CONFIG_VARS.clear()
sysconfig._CONFIG_VARS.update(self._backup_config_vars)