diff options
Diffstat (limited to 'setuptools/_distutils/tests/test_spawn.py')
-rw-r--r-- | setuptools/_distutils/tests/test_spawn.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/setuptools/_distutils/tests/test_spawn.py b/setuptools/_distutils/tests/test_spawn.py index 704019a1..f620da78 100644 --- a/setuptools/_distutils/tests/test_spawn.py +++ b/setuptools/_distutils/tests/test_spawn.py @@ -4,9 +4,9 @@ import stat import sys import unittest.mock from test.support import run_unittest -from test import support as test_support from .py35compat import unix_shell +from . import py38compat as os_helper from distutils.spawn import find_executable from distutils.spawn import spawn @@ -46,9 +46,9 @@ class SpawnTestCase(support.TempdirManager, spawn([exe]) # should work without any error def test_find_executable(self): - with test_support.temp_dir() as tmp_dir: + with os_helper.temp_dir() as tmp_dir: # use TESTFN to get a pseudo-unique filename - program_noeext = test_support.TESTFN + program_noeext = os_helper.TESTFN # Give the temporary program an ".exe" suffix for all. # It's needed on Windows and not harmful on other platforms. program = program_noeext + ".exe" @@ -68,7 +68,7 @@ class SpawnTestCase(support.TempdirManager, self.assertEqual(rv, filename) # test find in the current directory - with test_support.change_cwd(tmp_dir): + with os_helper.change_cwd(tmp_dir): rv = find_executable(program) self.assertEqual(rv, program) @@ -78,7 +78,7 @@ class SpawnTestCase(support.TempdirManager, self.assertIsNone(rv) # PATH='': no match, except in the current directory - with test_support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['PATH'] = '' with unittest.mock.patch('distutils.spawn.os.confstr', return_value=tmp_dir, create=True), \ @@ -88,12 +88,12 @@ class SpawnTestCase(support.TempdirManager, self.assertIsNone(rv) # look in current directory - with test_support.change_cwd(tmp_dir): + with os_helper.change_cwd(tmp_dir): rv = find_executable(program) self.assertEqual(rv, program) # PATH=':': explicitly looks in the current directory - with test_support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['PATH'] = os.pathsep with unittest.mock.patch('distutils.spawn.os.confstr', return_value='', create=True), \ @@ -102,12 +102,12 @@ class SpawnTestCase(support.TempdirManager, self.assertIsNone(rv) # look in current directory - with test_support.change_cwd(tmp_dir): + with os_helper.change_cwd(tmp_dir): rv = find_executable(program) self.assertEqual(rv, program) # missing PATH: test os.confstr("CS_PATH") and os.defpath - with test_support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env.pop('PATH', None) # without confstr @@ -129,7 +129,7 @@ class SpawnTestCase(support.TempdirManager, def test_spawn_missing_exe(self): with self.assertRaises(DistutilsExecError) as ctx: spawn(['does-not-exist']) - assert 'command does-no-exist failed' in str(ctx) + self.assertIn("command 'does-not-exist' failed", str(ctx.exception)) def test_suite(): |