mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
Use support.change_cwd() in tests.
This commit is contained in:
commit
5fbadb63ef
9 changed files with 34 additions and 104 deletions
|
@ -63,11 +63,9 @@ class PyCompileTests(unittest.TestCase):
|
|||
self.assertTrue(os.path.exists(self.cache_path))
|
||||
|
||||
def test_cwd(self):
|
||||
cwd = os.getcwd()
|
||||
os.chdir(self.directory)
|
||||
py_compile.compile(os.path.basename(self.source_path),
|
||||
os.path.basename(self.pyc_path))
|
||||
os.chdir(cwd)
|
||||
with support.change_cwd(self.directory):
|
||||
py_compile.compile(os.path.basename(self.source_path),
|
||||
os.path.basename(self.pyc_path))
|
||||
self.assertTrue(os.path.exists(self.pyc_path))
|
||||
self.assertFalse(os.path.exists(self.cache_path))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue