FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-43425: Update test_c_parser not to use TempdirManager by corona10 · Pull Request #26693 · python/cpython · GitHub

Repository navigation

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 8 additions & 5 deletions Lib/test/test_peg_generator/test_c_parser.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -68,20 +70,21 @@ def test_parse(self):
"""


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)

Expand Down

Back | FazBrowse Home | New Git URL