Skip to content

Commit

Permalink
Employ the TempdirManager to avoid creating 'scratch' in the test dir…
Browse files Browse the repository at this point in the history
…ectory. Fixes #72.
  • Loading branch information
jaraco committed Nov 28, 2021
1 parent 85db7a4 commit a8d097a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion distutils/tests/test_unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
from distutils.unixccompiler import UnixCCompiler
from distutils.util import _clear_cached_macosx_ver

class UnixCCompilerTestCase(unittest.TestCase):
from . import support

class UnixCCompilerTestCase(support.TempdirManager, unittest.TestCase):

def setUp(self):
super().setUp()
self._backup_platform = sys.platform
self._backup_get_config_var = sysconfig.get_config_var
self._backup_get_config_vars = sysconfig.get_config_vars
Expand All @@ -23,6 +26,7 @@ def rpath_foo(self):
self.cc = CompilerWrapper()

def tearDown(self):
super().tearDown()
sys.platform = self._backup_platform
sysconfig.get_config_var = self._backup_get_config_var
sysconfig.get_config_vars = self._backup_get_config_vars
Expand Down Expand Up @@ -237,6 +241,7 @@ def test_has_function(self):
# ensure that setting output_dir does not raise
# FileNotFoundError: [Errno 2] No such file or directory: 'a.out'
self.cc.output_dir = 'scratch'
os.chdir(self.mkdtemp())
self.cc.has_function('abort', includes=['stdlib.h'])


Expand Down

0 comments on commit a8d097a

Please sign in to comment.