diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-06-30 13:46:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 13:46:31 (GMT) |
commit | 0c4f0f3b29d84063700217dcf90ad6860ed71c70 (patch) | |
tree | 22c7c745a13327858287f8ea010794ba51af7be9 /Lib/test/test_shutil.py | |
parent | 3ddc634cd5469550c0c2dc5a6051a70739995699 (diff) | |
download | cpython-0c4f0f3b29d84063700217dcf90ad6860ed71c70.zip cpython-0c4f0f3b29d84063700217dcf90ad6860ed71c70.tar.gz cpython-0c4f0f3b29d84063700217dcf90ad6860ed71c70.tar.bz2 |
bpo-40275: Use new test.support helper submodules in tests (GH-21169)
Diffstat (limited to 'Lib/test/test_shutil.py')
-rw-r--r-- | Lib/test/test_shutil.py | 147 |
1 files changed, 74 insertions, 73 deletions
diff --git a/Lib/test/test_shutil.py b/Lib/test/test_shutil.py index e56b337..06ca50a 100644 --- a/Lib/test/test_shutil.py +++ b/Lib/test/test_shutil.py @@ -30,7 +30,8 @@ except ImportError: posix = None from test import support -from test.support import TESTFN, FakePath +from test.support import os_helper +from test.support.os_helper import TESTFN, FakePath TESTFN2 = TESTFN + "2" MACOS = sys.platform.startswith("darwin") @@ -140,9 +141,9 @@ def supports_file2file_sendfile(): return True finally: if srcname is not None: - support.unlink(srcname) + os_helper.unlink(srcname) if dstname is not None: - support.unlink(dstname) + os_helper.unlink(dstname) SUPPORTS_SENDFILE = supports_file2file_sendfile() @@ -168,7 +169,7 @@ class BaseTest: Returns the path of the directory. """ d = tempfile.mkdtemp(prefix=prefix, dir=os.getcwd()) - self.addCleanup(support.rmtree, d) + self.addCleanup(os_helper.rmtree, d) return d @@ -183,7 +184,7 @@ class TestRmTree(BaseTest, unittest.TestCase): self.assertIsInstance(victim, bytes) shutil.rmtree(victim) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_rmtree_fails_on_symlink(self): tmp = self.mkdtemp() dir_ = os.path.join(tmp, 'dir') @@ -202,7 +203,7 @@ class TestRmTree(BaseTest, unittest.TestCase): self.assertEqual(errors[0][1], link) self.assertIsInstance(errors[0][2][1], OSError) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_rmtree_works_on_symlinks(self): tmp = self.mkdtemp() dir1 = os.path.join(tmp, 'dir1') @@ -231,7 +232,7 @@ class TestRmTree(BaseTest, unittest.TestCase): os.mkdir(dir_) link = os.path.join(tmp, 'link') _winapi.CreateJunction(dir_, link) - self.addCleanup(support.unlink, link) + self.addCleanup(os_helper.unlink, link) self.assertRaises(OSError, shutil.rmtree, link) self.assertTrue(os.path.exists(dir_)) self.assertTrue(os.path.lexists(link)) @@ -313,7 +314,7 @@ class TestRmTree(BaseTest, unittest.TestCase): self.child_file_path = os.path.join(TESTFN, 'a') self.child_dir_path = os.path.join(TESTFN, 'b') - support.create_empty_file(self.child_file_path) + os_helper.create_empty_file(self.child_file_path) os.mkdir(self.child_dir_path) old_dir_mode = os.stat(TESTFN).st_mode old_child_file_mode = os.stat(self.child_file_path).st_mode @@ -407,7 +408,7 @@ class TestRmTree(BaseTest, unittest.TestCase): self.assertRaises(NotADirectoryError, shutil.rmtree, path) os.remove(path) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_rmtree_on_symlink(self): # bug 1669. os.mkdir(TESTFN) @@ -482,7 +483,7 @@ class TestCopyTree(BaseTest, unittest.TestCase): with self.assertRaises(FileExistsError): shutil.copytree(src_dir, dst_dir, dirs_exist_ok=False) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copytree_symlinks(self): tmp_dir = self.mkdtemp() src_dir = os.path.join(tmp_dir, 'src') @@ -634,7 +635,7 @@ class TestCopyTree(BaseTest, unittest.TestCase): write_file((src_dir, 'restrictive.txt'), '456') os.chmod(os.path.join(src_dir, 'restrictive.txt'), 0o600) restrictive_subdir = tempfile.mkdtemp(dir=src_dir) - self.addCleanup(support.rmtree, restrictive_subdir) + self.addCleanup(os_helper.rmtree, restrictive_subdir) os.chmod(restrictive_subdir, 0o600) shutil.copytree(src_dir, dst_dir) @@ -681,7 +682,7 @@ class TestCopyTree(BaseTest, unittest.TestCase): # Issue #3002: copyfile and copytree block indefinitely on named pipes @unittest.skipUnless(hasattr(os, "mkfifo"), 'requires os.mkfifo()') - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copytree_named_pipe(self): os.mkdir(TESTFN) try: @@ -719,7 +720,7 @@ class TestCopyTree(BaseTest, unittest.TestCase): shutil.copytree(src_dir, dst_dir, copy_function=_copy) self.assertEqual(len(copied), 2) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copytree_dangling_symlinks(self): # a dangling symlink raises an error at the end src_dir = self.mkdtemp() @@ -739,7 +740,7 @@ class TestCopyTree(BaseTest, unittest.TestCase): shutil.copytree(src_dir, dst_dir, symlinks=True) self.assertIn('test.txt', os.listdir(dst_dir)) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copytree_symlink_dir(self): src_dir = self.mkdtemp() dst_dir = os.path.join(self.mkdtemp(), 'destination') @@ -785,7 +786,7 @@ class TestCopy(BaseTest, unittest.TestCase): ### shutil.copymode - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copymode_follow_symlinks(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -818,7 +819,7 @@ class TestCopy(BaseTest, unittest.TestCase): self.assertEqual(os.stat(src).st_mode, os.stat(dst).st_mode) @unittest.skipUnless(hasattr(os, 'lchmod'), 'requires os.lchmod') - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copymode_symlink_to_symlink(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -848,7 +849,7 @@ class TestCopy(BaseTest, unittest.TestCase): self.assertEqual(os.stat(src).st_mode, os.stat(dst).st_mode) @unittest.skipIf(hasattr(os, 'lchmod'), 'requires os.lchmod to be missing') - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copymode_symlink_to_symlink_wo_lchmod(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -863,7 +864,7 @@ class TestCopy(BaseTest, unittest.TestCase): ### shutil.copystat - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copystat_symlinks(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -935,7 +936,7 @@ class TestCopy(BaseTest, unittest.TestCase): ### shutil.copyxattr - @support.skip_unless_xattr + @os_helper.skip_unless_xattr def test_copyxattr(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -999,8 +1000,8 @@ class TestCopy(BaseTest, unittest.TestCase): self.assertEqual(os.getxattr(dst, 'user.the_value'), b'fiddly') self.assertEqual(os.getxattr(dstro, 'user.the_value'), b'fiddly') - @support.skip_unless_symlink - @support.skip_unless_xattr + @os_helper.skip_unless_symlink + @os_helper.skip_unless_xattr @unittest.skipUnless(hasattr(os, 'geteuid') and os.geteuid() == 0, 'root privileges required') def test_copyxattr_symlinks(self): @@ -1042,7 +1043,7 @@ class TestCopy(BaseTest, unittest.TestCase): self.assertTrue(os.path.exists(file2)) self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copy_symlinks(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -1084,7 +1085,7 @@ class TestCopy(BaseTest, unittest.TestCase): self.assertEqual(getattr(file1_stat, 'st_flags'), getattr(file2_stat, 'st_flags')) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copy2_symlinks(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -1119,7 +1120,7 @@ class TestCopy(BaseTest, unittest.TestCase): if hasattr(os, 'lchflags') and hasattr(src_link_stat, 'st_flags'): self.assertEqual(src_link_stat.st_flags, dst_stat.st_flags) - @support.skip_unless_xattr + @os_helper.skip_unless_xattr def test_copy2_xattr(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'foo') @@ -1146,7 +1147,7 @@ class TestCopy(BaseTest, unittest.TestCase): ### shutil.copyfile - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_copyfile_symlinks(self): tmp_dir = self.mkdtemp() src = os.path.join(tmp_dir, 'src') @@ -1183,7 +1184,7 @@ class TestCopy(BaseTest, unittest.TestCase): finally: shutil.rmtree(TESTFN, ignore_errors=True) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink def test_dont_copy_file_onto_symlink_to_itself(self): # bug 851123. os.mkdir(TESTFN) @@ -1258,7 +1259,7 @@ class TestArchives(BaseTest, unittest.TestCase): work_dir = os.path.dirname(tmpdir2) rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive') - with support.change_cwd(work_dir): + with os_helper.change_cwd(work_dir): base_name = os.path.abspath(rel_base_name) tarball = make_archive(rel_base_name, 'gztar', root_dir, '.') @@ -1272,7 +1273,7 @@ class TestArchives(BaseTest, unittest.TestCase): './file1', './file2', './sub/file3']) # trying an uncompressed one - with support.change_cwd(work_dir): + with os_helper.change_cwd(work_dir): tarball = make_archive(rel_base_name, 'tar', root_dir, '.') self.assertEqual(tarball, base_name + '.tar') self.assertTrue(os.path.isfile(tarball)) @@ -1347,7 +1348,7 @@ class TestArchives(BaseTest, unittest.TestCase): work_dir = os.path.dirname(tmpdir2) rel_base_name = os.path.join(os.path.basename(tmpdir2), 'archive') - with support.change_cwd(work_dir): + with os_helper.change_cwd(work_dir): base_name = os.path.abspath(rel_base_name) res = make_archive(rel_base_name, 'zip', root_dir) @@ -1360,7 +1361,7 @@ class TestArchives(BaseTest, unittest.TestCase): 'dist/file1', 'dist/file2', 'dist/sub/file3', 'outer']) - with support.change_cwd(work_dir): + with os_helper.change_cwd(work_dir): base_name = os.path.abspath(rel_base_name) res = make_archive(rel_base_name, 'zip', root_dir, base_dir) @@ -1412,7 +1413,7 @@ class TestArchives(BaseTest, unittest.TestCase): # now check the ZIP file using `unzip -t` zip_cmd = ['unzip', '-t', archive] - with support.change_cwd(root_dir): + with os_helper.change_cwd(root_dir): try: subprocess.check_output(zip_cmd, stderr=subprocess.STDOUT) except subprocess.CalledProcessError as exc: @@ -1462,7 +1463,7 @@ class TestArchives(BaseTest, unittest.TestCase): base_name = os.path.join(self.mkdtemp(), 'archive') group = grp.getgrgid(0)[0] owner = pwd.getpwuid(0)[0] - with support.change_cwd(root_dir): + with os_helper.change_cwd(root_dir): archive_name = make_archive(base_name, 'gztar', root_dir, 'dist', owner=owner, group=group) @@ -1496,7 +1497,7 @@ class TestArchives(BaseTest, unittest.TestCase): def test_make_tarfile_in_curdir(self): # Issue #21280 root_dir = self.mkdtemp() - with support.change_cwd(root_dir): + with os_helper.change_cwd(root_dir): self.assertEqual(make_archive('test', 'tar'), 'test.tar') self.assertTrue(os.path.isfile('test.tar')) @@ -1504,7 +1505,7 @@ class TestArchives(BaseTest, unittest.TestCase): def test_make_zipfile_in_curdir(self): # Issue #21280 root_dir = self.mkdtemp() - with support.change_cwd(root_dir): + with os_helper.change_cwd(root_dir): self.assertEqual(make_archive('test', 'zip'), 'test.zip') self.assertTrue(os.path.isfile('test.zip')) @@ -1711,18 +1712,18 @@ class TestWhich(BaseTest, unittest.TestCase): # that exists, it should be returned. base_dir, tail_dir = os.path.split(self.dir) relpath = os.path.join(tail_dir, self.file) - with support.change_cwd(path=base_dir): + with os_helper.change_cwd(path=base_dir): rv = shutil.which(relpath, path=self.temp_dir) self.assertEqual(rv, relpath) # But it shouldn't be searched in PATH directories (issue #16957). - with support.change_cwd(path=self.dir): + with os_helper.change_cwd(path=self.dir): rv = shutil.which(relpath, path=base_dir) self.assertIsNone(rv) def test_cwd(self): # Issue #16957 base_dir = os.path.dirname(self.dir) - with support.change_cwd(path=self.dir): + with os_helper.change_cwd(path=self.dir): rv = shutil.which(self.file, path=base_dir) if sys.platform == "win32": # Windows: current directory implicitly on PATH @@ -1743,7 +1744,7 @@ class TestWhich(BaseTest, unittest.TestCase): def test_relative_path(self): base_dir, tail_dir = os.path.split(self.dir) - with support.change_cwd(path=base_dir): + with os_helper.change_cwd(path=base_dir): rv = shutil.which(self.file, path=tail_dir) self.assertEqual(rv, os.path.join(tail_dir, self.file)) @@ -1761,19 +1762,19 @@ class TestWhich(BaseTest, unittest.TestCase): self.assertEqual(rv, self.temp_file.name[:-4] + self.ext) def test_environ_path(self): - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['PATH'] = self.env_path rv = shutil.which(self.file) self.assertEqual(rv, self.temp_file.name) def test_environ_path_empty(self): # PATH='': no match - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['PATH'] = '' with unittest.mock.patch('os.confstr', return_value=self.dir, \ create=True), \ support.swap_attr(os, 'defpath', self.dir), \ - support.change_cwd(self.dir): + os_helper.change_cwd(self.dir): rv = shutil.which(self.file) self.assertIsNone(rv) @@ -1786,7 +1787,7 @@ class TestWhich(BaseTest, unittest.TestCase): expected_cwd = os.path.join(curdir, expected_cwd) # PATH=':': explicitly looks in the current directory - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['PATH'] = os.pathsep with unittest.mock.patch('os.confstr', return_value=self.dir, \ create=True), \ @@ -1795,12 +1796,12 @@ class TestWhich(BaseTest, unittest.TestCase): self.assertIsNone(rv) # look in current directory - with support.change_cwd(self.dir): + with os_helper.change_cwd(self.dir): rv = shutil.which(self.file) self.assertEqual(rv, expected_cwd) def test_environ_path_missing(self): - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env.pop('PATH', None) # without confstr @@ -1819,14 +1820,14 @@ class TestWhich(BaseTest, unittest.TestCase): def test_empty_path(self): base_dir = os.path.dirname(self.dir) - with support.change_cwd(path=self.dir), \ - support.EnvironmentVarGuard() as env: + with os_helper.change_cwd(path=self.dir), \ + os_helper.EnvironmentVarGuard() as env: env['PATH'] = self.env_path rv = shutil.which(self.file, path='') self.assertIsNone(rv) def test_empty_path_no_PATH(self): - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env.pop('PATH', None) rv = shutil.which(self.file) self.assertIsNone(rv) @@ -1843,7 +1844,7 @@ class TestWhich(BaseTest, unittest.TestCase): program = os.path.basename(temp_filexyz.name) program = os.path.splitext(program)[0] - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['PATHEXT'] = ext rv = shutil.which(program, path=self.temp_dir) self.assertEqual(rv, temp_filexyz.name) @@ -1918,7 +1919,7 @@ class TestMove(BaseTest, unittest.TestCase): try: self._check_move_dir(self.src_dir, dst_dir, dst_dir) finally: - support.rmtree(dst_dir) + os_helper.rmtree(dst_dir) @mock_rename def test_move_dir_other_fs(self): @@ -1965,7 +1966,7 @@ class TestMove(BaseTest, unittest.TestCase): msg='_destinsrc() wrongly concluded that ' 'dst (%s) is not in src (%s)' % (dst, src)) finally: - support.rmtree(TESTFN) + os_helper.rmtree(TESTFN) def test_destinsrc_false_positive(self): os.mkdir(TESTFN) @@ -1977,9 +1978,9 @@ class TestMove(BaseTest, unittest.TestCase): msg='_destinsrc() wrongly concluded that ' 'dst (%s) is in src (%s)' % (dst, src)) finally: - support.rmtree(TESTFN) + os_helper.rmtree(TESTFN) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink @mock_rename def test_move_file_symlink(self): dst = os.path.join(self.src_dir, 'bar') @@ -1988,7 +1989,7 @@ class TestMove(BaseTest, unittest.TestCase): self.assertTrue(os.path.islink(self.dst_file)) self.assertTrue(os.path.samefile(self.src_file, self.dst_file)) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink @mock_rename def test_move_file_symlink_to_dir(self): filename = "bar" @@ -1999,7 +2000,7 @@ class TestMove(BaseTest, unittest.TestCase): self.assertTrue(os.path.islink(final_link)) self.assertTrue(os.path.samefile(self.src_file, final_link)) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink @mock_rename def test_move_dangling_symlink(self): src = os.path.join(self.src_dir, 'baz') @@ -2010,7 +2011,7 @@ class TestMove(BaseTest, unittest.TestCase): self.assertTrue(os.path.islink(dst_link)) self.assertEqual(os.path.realpath(src), os.path.realpath(dst_link)) - @support.skip_unless_symlink + @os_helper.skip_unless_symlink @mock_rename def test_move_dir_symlink(self): src = os.path.join(self.src_dir, 'baz') @@ -2044,8 +2045,8 @@ class TestMove(BaseTest, unittest.TestCase): moved = [] def _copy(src, dst): moved.append((src, dst)) - support.create_empty_file(os.path.join(self.src_dir, 'child')) - support.create_empty_file(os.path.join(self.src_dir, 'child1')) + os_helper.create_empty_file(os.path.join(self.src_dir, 'child')) + os_helper.create_empty_file(os.path.join(self.src_dir, 'child1')) shutil.move(self.src_dir, self.dst_dir, copy_function=_copy) self.assertEqual(len(moved), 3) @@ -2167,11 +2168,11 @@ class TestCopyFileObj(unittest.TestCase): @classmethod def tearDownClass(cls): - support.unlink(TESTFN) - support.unlink(TESTFN2) + os_helper.unlink(TESTFN) + os_helper.unlink(TESTFN2) def tearDown(self): - support.unlink(TESTFN2) + os_helper.unlink(TESTFN2) @contextlib.contextmanager def get_files(self): @@ -2216,7 +2217,7 @@ class TestCopyFileObj(unittest.TestCase): with tempfile.NamedTemporaryFile(dir=os.getcwd(), delete=False) as f: f.write(b'foo') fname = f.name - self.addCleanup(support.unlink, fname) + self.addCleanup(os_helper.unlink, fname) with unittest.mock.patch("shutil._copyfileobj_readinto") as m: shutil.copyfile(fname, TESTFN2) self.assertEqual(m.call_args[0][2], 3) @@ -2225,7 +2226,7 @@ class TestCopyFileObj(unittest.TestCase): with tempfile.NamedTemporaryFile(dir=os.getcwd(), delete=False) as f: pass fname = f.name - self.addCleanup(support.unlink, fname) + self.addCleanup(os_helper.unlink, fname) with unittest.mock.patch("shutil._copyfileobj_readinto") as m: shutil.copyfile(fname, TESTFN2) assert not m.called @@ -2247,10 +2248,10 @@ class _ZeroCopyFileTest(object): @classmethod def tearDownClass(cls): - support.unlink(TESTFN) + os_helper.unlink(TESTFN) def tearDown(self): - support.unlink(TESTFN2) + os_helper.unlink(TESTFN2) @contextlib.contextmanager def get_files(self): @@ -2296,8 +2297,8 @@ class _ZeroCopyFileTest(object): def test_empty_file(self): srcname = TESTFN + 'src' dstname = TESTFN + 'dst' - self.addCleanup(lambda: support.unlink(srcname)) - self.addCleanup(lambda: support.unlink(dstname)) + self.addCleanup(lambda: os_helper.unlink(srcname)) + self.addCleanup(lambda: os_helper.unlink(dstname)) with open(srcname, "wb"): pass @@ -2421,9 +2422,9 @@ class TestZeroCopySendfile(_ZeroCopyFileTest, unittest.TestCase): # sendfile() are the same. self.assertEqual(blocksize, os.path.getsize(TESTFN)) # ...unless we're dealing with a small file. - support.unlink(TESTFN2) + os_helper.unlink(TESTFN2) write_file(TESTFN2, b"hello", binary=True) - self.addCleanup(support.unlink, TESTFN2 + '3') + self.addCleanup(os_helper.unlink, TESTFN2 + '3') self.assertRaises(ZeroDivisionError, shutil.copyfile, TESTFN2, TESTFN2 + '3') blocksize = m.call_args[0][3] @@ -2473,20 +2474,20 @@ class TestGetTerminalSize(unittest.TestCase): def test_os_environ_first(self): "Check if environment variables have precedence" - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['COLUMNS'] = '777' del env['LINES'] size = shutil.get_terminal_size() self.assertEqual(size.columns, 777) - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: del env['COLUMNS'] env['LINES'] = '888' size = shutil.get_terminal_size() self.assertEqual(size.lines, 888) def test_bad_environ(self): - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: env['COLUMNS'] = 'xxx' env['LINES'] = 'yyy' size = shutil.get_terminal_size() @@ -2510,7 +2511,7 @@ class TestGetTerminalSize(unittest.TestCase): self.skipTest("stty invocation failed") expected = (int(size[1]), int(size[0])) # reversed order - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: del env['LINES'] del env['COLUMNS'] actual = shutil.get_terminal_size() @@ -2518,7 +2519,7 @@ class TestGetTerminalSize(unittest.TestCase): self.assertEqual(expected, actual) def test_fallback(self): - with support.EnvironmentVarGuard() as env: + with os_helper.EnvironmentVarGuard() as env: del env['LINES'] del env['COLUMNS'] |