mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
remove some skipIf and enable shutil CI for windows (#5235)
* mark failing shtuil tests in windows * unsetenv raise more informed error * Remove a few skipIf for windows
This commit is contained in:
1 parent
39822d7e57
commit
49cfcd817d
8 files changed
+43
-8
No files matched your search
@@ -24,7 +24,6 @@ env:
|
||||
test_os
|
||||
test_pathlib
|
||||
test_posixpath
|
||||
test_shutil
|
||||
test_venv
|
||||
# configparser: https://github.com/RustPython/RustPython/issues/4995#issuecomment-1582397417
|
||||
# socketserver: seems related to configparser crash.
|
||||
|
||||
Vendored
+1
-1
@@ -1363,7 +1363,7 @@ class BuiltinTest(unittest.TestCase):
|
||||
os.environ.clear()
|
||||
os.environ.update(old_environ)
|
||||
|
||||
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
|
||||
@unittest.expectedFailureIfWindows('TODO: RUSTPYTHON Windows')
|
||||
@support.requires_subprocess()
|
||||
def test_open_non_inheritable(self):
|
||||
fileobj = open(__file__, encoding="utf-8")
|
||||
|
||||
Vendored
+2
-2
@@ -945,7 +945,7 @@ class ArgsTestCase(BaseTestCase):
|
||||
""")
|
||||
self.check_leak(code, 'file descriptors')
|
||||
|
||||
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
|
||||
@unittest.expectedFailureIfWindows('TODO: RUSTPYTHON Windows')
|
||||
def test_list_tests(self):
|
||||
# test --list-tests
|
||||
tests = [self.create_test() for i in range(5)]
|
||||
@@ -953,7 +953,7 @@ class ArgsTestCase(BaseTestCase):
|
||||
self.assertEqual(output.rstrip().splitlines(),
|
||||
tests)
|
||||
|
||||
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
|
||||
@unittest.expectedFailureIfWindows('TODO: RUSTPYTHON Windows')
|
||||
def test_list_cases(self):
|
||||
# test --list-cases
|
||||
code = textwrap.dedent("""
|
||||
|
||||
Vendored
+37
@@ -196,6 +196,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
||||
self.assertIsInstance(victim, bytes)
|
||||
shutil.rmtree(victim)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_rmtree_fails_on_symlink_onerror(self):
|
||||
tmp = self.mkdtemp()
|
||||
@@ -215,6 +216,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
||||
self.assertEqual(errors[0][1], link)
|
||||
self.assertIsInstance(errors[0][2][1], OSError)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_rmtree_fails_on_symlink_onexc(self):
|
||||
tmp = self.mkdtemp()
|
||||
@@ -234,6 +236,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
||||
self.assertEqual(errors[0][1], link)
|
||||
self.assertIsInstance(errors[0][2], OSError)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_rmtree_works_on_symlinks(self):
|
||||
tmp = self.mkdtemp()
|
||||
@@ -256,6 +259,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
||||
self.assertTrue(os.path.exists(dir3))
|
||||
self.assertTrue(os.path.exists(file1))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@unittest.skipUnless(_winapi, 'only relevant on Windows')
|
||||
def test_rmtree_fails_on_junctions_onerror(self):
|
||||
tmp = self.mkdtemp()
|
||||
@@ -276,6 +280,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
||||
self.assertEqual(errors[0][1], link)
|
||||
self.assertIsInstance(errors[0][2][1], OSError)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@unittest.skipUnless(_winapi, 'only relevant on Windows')
|
||||
def test_rmtree_fails_on_junctions_onexc(self):
|
||||
tmp = self.mkdtemp()
|
||||
@@ -296,6 +301,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
||||
self.assertEqual(errors[0][1], link)
|
||||
self.assertIsInstance(errors[0][2], OSError)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@unittest.skipUnless(_winapi, 'only relevant on Windows')
|
||||
def test_rmtree_works_on_junctions(self):
|
||||
tmp = self.mkdtemp()
|
||||
@@ -655,6 +661,7 @@ class TestRmTree(BaseTest, unittest.TestCase):
|
||||
finally:
|
||||
shutil.rmtree(TESTFN, ignore_errors=True)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@unittest.skipUnless(_winapi, 'only relevant on Windows')
|
||||
def test_rmtree_on_junction(self):
|
||||
os.mkdir(TESTFN)
|
||||
@@ -708,6 +715,7 @@ class TestCopyTree(BaseTest, unittest.TestCase):
|
||||
actual = read_file((dst_dir, 'test_dir', 'test.txt'))
|
||||
self.assertEqual(actual, '456')
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_copytree_dirs_exist_ok(self):
|
||||
src_dir = self.mkdtemp()
|
||||
dst_dir = self.mkdtemp()
|
||||
@@ -733,6 +741,7 @@ class TestCopyTree(BaseTest, unittest.TestCase):
|
||||
with self.assertRaises(FileExistsError):
|
||||
shutil.copytree(src_dir, dst_dir, dirs_exist_ok=False)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copytree_symlinks(self):
|
||||
tmp_dir = self.mkdtemp()
|
||||
@@ -972,6 +981,7 @@ class TestCopyTree(BaseTest, unittest.TestCase):
|
||||
shutil.copytree(src_dir, dst_dir, copy_function=_copy)
|
||||
self.assertEqual(len(copied), 2)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copytree_dangling_symlinks(self):
|
||||
src_dir = self.mkdtemp()
|
||||
@@ -999,6 +1009,7 @@ class TestCopyTree(BaseTest, unittest.TestCase):
|
||||
shutil.copytree(src_dir, dst_dir, symlinks=True)
|
||||
self.assertIn('test.txt', os.listdir(dst_dir))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copytree_symlink_dir(self):
|
||||
src_dir = self.mkdtemp()
|
||||
@@ -1045,6 +1056,7 @@ class TestCopy(BaseTest, unittest.TestCase):
|
||||
|
||||
### shutil.copymode
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copymode_follow_symlinks(self):
|
||||
tmp_dir = self.mkdtemp()
|
||||
@@ -1126,6 +1138,7 @@ class TestCopy(BaseTest, unittest.TestCase):
|
||||
|
||||
### shutil.copystat
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copystat_symlinks(self):
|
||||
tmp_dir = self.mkdtemp()
|
||||
@@ -1306,6 +1319,7 @@ class TestCopy(BaseTest, unittest.TestCase):
|
||||
self.assertTrue(os.path.exists(file2))
|
||||
self.assertEqual(os.stat(file1).st_mode, os.stat(file2).st_mode)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copy_symlinks(self):
|
||||
tmp_dir = self.mkdtemp()
|
||||
@@ -1348,6 +1362,7 @@ class TestCopy(BaseTest, unittest.TestCase):
|
||||
self.assertEqual(getattr(file1_stat, 'st_flags'),
|
||||
getattr(file2_stat, 'st_flags'))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copy2_symlinks(self):
|
||||
tmp_dir = self.mkdtemp()
|
||||
@@ -1432,6 +1447,7 @@ class TestCopy(BaseTest, unittest.TestCase):
|
||||
|
||||
### shutil.copyfile
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_copyfile_symlinks(self):
|
||||
tmp_dir = self.mkdtemp()
|
||||
@@ -1542,6 +1558,7 @@ class TestCopy(BaseTest, unittest.TestCase):
|
||||
write_file(src_file, 'foo')
|
||||
self.assertRaises(FileNotFoundError, shutil.copyfile, src_file, dst)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_copyfile_copy_dir(self):
|
||||
# Issue 45234
|
||||
# test copy() and copyfile() raising proper exceptions when src and/or
|
||||
@@ -2482,15 +2499,18 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
# Move a file to another location on the same filesystem.
|
||||
self._check_move_file(self.src_file, self.dst_file, self.dst_file)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_move_file_to_dir(self):
|
||||
# Move a file inside an existing dir on the same filesystem.
|
||||
self._check_move_file(self.src_file, self.dst_dir, self.dst_file)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_move_file_to_dir_pathlike_src(self):
|
||||
# Move a pathlike file to another location on the same filesystem.
|
||||
src = pathlib.Path(self.src_file)
|
||||
self._check_move_file(src, self.dst_dir, self.dst_file)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_move_file_to_dir_pathlike_dst(self):
|
||||
# Move a file to another pathlike location on the same filesystem.
|
||||
dst = pathlib.Path(self.dst_dir)
|
||||
@@ -2501,6 +2521,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
# Move a file to an existing dir on another filesystem.
|
||||
self.test_move_file()
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@mock_rename
|
||||
def test_move_file_to_dir_other_fs(self):
|
||||
# Move a file to another location on another filesystem.
|
||||
@@ -2519,25 +2540,30 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
# Move a dir to another location on another filesystem.
|
||||
self.test_move_dir()
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_move_dir_to_dir(self):
|
||||
# Move a dir inside an existing dir on the same filesystem.
|
||||
self._check_move_dir(self.src_dir, self.dst_dir,
|
||||
os.path.join(self.dst_dir, os.path.basename(self.src_dir)))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@mock_rename
|
||||
def test_move_dir_to_dir_other_fs(self):
|
||||
# Move a dir inside an existing dir on another filesystem.
|
||||
self.test_move_dir_to_dir()
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_move_dir_sep_to_dir(self):
|
||||
self._check_move_dir(self.src_dir + os.path.sep, self.dst_dir,
|
||||
os.path.join(self.dst_dir, os.path.basename(self.src_dir)))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@unittest.skipUnless(os.path.altsep, 'requires os.path.altsep')
|
||||
def test_move_dir_altsep_to_dir(self):
|
||||
self._check_move_dir(self.src_dir + os.path.altsep, self.dst_dir,
|
||||
os.path.join(self.dst_dir, os.path.basename(self.src_dir)))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_existing_file_inside_dest_dir(self):
|
||||
# A file with the same name inside the destination dir already exists.
|
||||
with open(self.dst_file, "wb"):
|
||||
@@ -2573,6 +2599,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
finally:
|
||||
os_helper.rmtree(TESTFN)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
@mock_rename
|
||||
def test_move_file_symlink(self):
|
||||
@@ -2582,6 +2609,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))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
@mock_rename
|
||||
def test_move_file_symlink_to_dir(self):
|
||||
@@ -2593,6 +2621,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
self.assertTrue(os.path.islink(final_link))
|
||||
self.assertTrue(os.path.samefile(self.src_file, final_link))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
@mock_rename
|
||||
def test_move_dangling_symlink(self):
|
||||
@@ -2604,6 +2633,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
self.assertTrue(os.path.islink(dst_link))
|
||||
self.assertEqual(os.path.realpath(src), os.path.realpath(dst_link))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
@mock_rename
|
||||
def test_move_dir_symlink(self):
|
||||
@@ -2616,6 +2646,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
self.assertTrue(os.path.islink(dst_link))
|
||||
self.assertTrue(os.path.samefile(src, dst_link))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
def test_move_return_value(self):
|
||||
rv = shutil.move(self.src_file, self.dst_dir)
|
||||
self.assertEqual(rv,
|
||||
@@ -2625,6 +2656,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
rv = shutil.move(self.src_file, os.path.join(self.dst_dir, 'bar'))
|
||||
self.assertEqual(rv, os.path.join(self.dst_dir, 'bar'))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@mock_rename
|
||||
def test_move_file_special_function(self):
|
||||
moved = []
|
||||
@@ -2633,6 +2665,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
shutil.move(self.src_file, self.dst_dir, copy_function=_copy)
|
||||
self.assertEqual(len(moved), 1)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@mock_rename
|
||||
def test_move_dir_special_function(self):
|
||||
moved = []
|
||||
@@ -2661,6 +2694,7 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
|
||||
# bpo-26791: Check that a symlink to a directory can
|
||||
# be moved into that directory.
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@mock_rename
|
||||
def _test_move_symlink_to_dir_into_dir(self, dst):
|
||||
src = os.path.join(self.src_dir, 'linktodir')
|
||||
@@ -2679,10 +2713,12 @@ class TestMove(BaseTest, unittest.TestCase):
|
||||
self.assertTrue(os.path.samefile(self.dst_dir, dst_link))
|
||||
self.assertTrue(os.path.exists(src))
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_move_symlink_to_dir_into_dir(self):
|
||||
self._test_move_symlink_to_dir_into_dir(self.dst_dir)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@os_helper.skip_unless_symlink
|
||||
def test_move_symlink_to_dir_into_symlink_to_dir(self):
|
||||
dst = os.path.join(self.src_dir, 'otherlinktodir')
|
||||
@@ -2859,6 +2895,7 @@ class TestCopyFileObj(unittest.TestCase):
|
||||
self.assertEqual(src.tell(), self.FILESIZE)
|
||||
self.assertEqual(dst.tell(), self.FILESIZE)
|
||||
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
|
||||
@unittest.skipIf(os.name != 'nt', "Windows only")
|
||||
def test_win_impl(self):
|
||||
# Make sure alternate Windows implementation is called.
|
||||
|
||||
Vendored
+1
-1
@@ -811,7 +811,7 @@ class ProcessTestCase(BaseTestCase):
|
||||
if not is_env_var_to_ignore(k)]
|
||||
self.assertEqual(child_env_names, [])
|
||||
|
||||
@unittest.skipIf(sys.platform == "win32", "TODO: RUSTPYTHON, null byte is not checked")
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON, null byte is not checked")
|
||||
def test_invalid_cmd(self):
|
||||
# null character in the command name
|
||||
cmd = sys.executable + '\0'
|
||||
|
||||
Vendored
+1
-1
@@ -310,7 +310,7 @@ class TestSupport(unittest.TestCase):
|
||||
def test_sortdict(self):
|
||||
self.assertEqual(support.sortdict({3:3, 2:2, 1:1}), "{1: 1, 2: 2, 3: 3}")
|
||||
|
||||
@unittest.skipIf(sys.platform.startswith("win"), "TODO: RUSTPYTHON; actual c fds on windows")
|
||||
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; actual c fds on windows")
|
||||
def test_make_bad_fd(self):
|
||||
fd = os_helper.make_bad_fd()
|
||||
with self.assertRaises(OSError) as cm:
|
||||
|
||||
Vendored
-1
@@ -50,7 +50,6 @@ class TempFileGreedy(threading.Thread):
|
||||
|
||||
|
||||
class ThreadedTempFileTest(unittest.TestCase):
|
||||
@unittest.skipIf(sys.platform == 'win32', 'TODO: RUSTPYTHON Windows')
|
||||
def test_main(self):
|
||||
threads = [TempFileGreedy() for i in range(NUM_THREADS)]
|
||||
with threading_helper.start_threads(threads, startEvent.set):
|
||||
|
||||
+1
-1
@@ -407,7 +407,7 @@ pub(super) mod _os {
|
||||
return Err(vm.new_value_error("embedded null byte".to_string()));
|
||||
}
|
||||
if key.is_empty() || key.contains('=') {
|
||||
return Err(vm.new_errno_error(22, "Invalid argument".to_owned()));
|
||||
return Err(vm.new_errno_error(22, format!("Invalid argument: {key}")));
|
||||
}
|
||||
env::remove_var(key);
|
||||
Ok(())
|
||||
|
||||
Reference in new issue
Block a user