From 82dfef6313711b5cc3a4174917debb63967d6d50 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 10:42:19 +0100 Subject: [PATCH 01/80] move test_os to independant tests --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 601b379118..8612c1a822 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,6 +76,7 @@ env: test_math test_operator test_ordered_dict + test_os test_pow test_raise test_richcmp @@ -293,7 +294,6 @@ jobs: test_importlib test_io test_iter - test_os test_pathlib test_posixpath test_shutil From e0510612efd1cbb8ad43191a73b107ca165406a9 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:02:04 +0100 Subject: [PATCH 02/80] test_closerange --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index d801bd8ec0..078dcc107d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -186,6 +186,7 @@ def test_access(self): os.close(f) self.assertTrue(os.access(os_helper.TESTFN, os.W_OK)) + @requires_os_func('dup') def test_closerange(self): first = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR) # We must allocate two consecutive file descriptors, otherwise From 5080806c690b78230b8e24ee1705725557a16992 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:08:17 +0100 Subject: [PATCH 03/80] test_execve_invalid_env --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 078dcc107d..3a0687e3e0 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2058,6 +2058,7 @@ def test_internal_execvpe_str(self): if os.name != "nt": self._test_internal_execvpe(bytes) + @requires_os_func('execve') def test_execve_invalid_env(self): args = [sys.executable, '-c', 'pass'] From 3356fe1f67ff8c52e153cbc06b999bdb6ddd2bcb Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:12:28 +0100 Subject: [PATCH 04/80] test_execve_with_empty_path --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 3a0687e3e0..5ac70801b7 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2080,6 +2080,7 @@ def test_execve_invalid_env(self): with self.assertRaises(ValueError): os.execve(args[0], args, newenv) + @requires_os_func('execve') @unittest.skipUnless(sys.platform == "win32", "Win32-specific test") def test_execve_with_empty_path(self): # bpo-32890: Check GetLastError() misuse From 01911f543c8397a01fae8254ca5d77ad04436605 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:15:56 +0100 Subject: [PATCH 05/80] test_execvpe_with_bad_arglist --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5ac70801b7..b86903b12c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1999,6 +1999,8 @@ def test_execv_with_bad_arglist(self): self.assertRaises(ValueError, os.execv, 'notepad', ('',)) self.assertRaises(ValueError, os.execv, 'notepad', ['']) + # NOTE: os.execvpe but calls os.execve inside + @requires_os_func('execve') def test_execvpe_with_bad_arglist(self): self.assertRaises(ValueError, os.execvpe, 'notepad', [], None) self.assertRaises(ValueError, os.execvpe, 'notepad', [], {}) From 988038977791d687968fb951a55c0f06aeeaee77 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:20:20 +0100 Subject: [PATCH 06/80] remove test_iter from platform-dependent tests --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8612c1a822..edbca3355d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -293,7 +293,6 @@ jobs: test_glob test_importlib test_io - test_iter test_pathlib test_posixpath test_shutil From dd4dd4b4b9a045becb053738e2d06f915828f090 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:24:35 +0100 Subject: [PATCH 07/80] _execvpe_mockup --- Lib/test/test_os.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index b86903b12c..6b6d264ebb 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1972,7 +1972,8 @@ def mock_execve(name, *args): try: orig_execv = os.execv - orig_execve = os.execve + # os.execve not implemented yet for all platforms + orig_execve = getattr(os, "execve", None) orig_defpath = os.defpath os.execv = mock_execv os.execve = mock_execve @@ -1981,7 +1982,10 @@ def mock_execve(name, *args): yield calls finally: os.execv = orig_execv - os.execve = orig_execve + if orig_execve: + os.execve = orig_execve + else: + del os.execve os.defpath = orig_defpath @unittest.skipUnless(hasattr(os, 'execv'), From aa44ee9d33d5d72e22c9e3052752186eb607e606 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:27:27 +0100 Subject: [PATCH 08/80] test_dup_nul --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 6b6d264ebb..2ecfa58e20 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4032,6 +4032,7 @@ def test_dup_standard_stream(self): self.addCleanup(os.close, fd) self.assertGreater(fd, 0) + @requires_os_func('dup') @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') def test_dup_nul(self): # os.dup() was creating inheritable fds for character files. From 5463487193bb5929743bac8a4465d0d306857a64 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:28:35 +0100 Subject: [PATCH 09/80] test_get_set_inheritable --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 2ecfa58e20..1899e5a03d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3945,6 +3945,7 @@ def test_cpu_count(self): class FDInheritanceTests(unittest.TestCase): + @requires_os_func('get_inheritable') def test_get_set_inheritable(self): fd = os.open(__file__, os.O_RDONLY) self.addCleanup(os.close, fd) From e27c02fc1ee2996d0acdb22a2dd9d6ced8569955 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:29:21 +0100 Subject: [PATCH 10/80] test_get_set_inheritable_badf --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 1899e5a03d..d9b71dd2a8 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3990,6 +3990,7 @@ def test_get_set_inheritable_o_path(self): os.set_inheritable(fd, False) self.assertEqual(os.get_inheritable(fd), False) + @requires_os_func('get_inheritable') def test_get_set_inheritable_badf(self): fd = os_helper.make_bad_fd() From b6620ea9771dbf1b1e9e8ee68e3a735c7b57cf6f Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:30:52 +0100 Subject: [PATCH 11/80] test_open --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index d9b71dd2a8..6865cdc0d8 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4006,6 +4006,7 @@ def test_get_set_inheritable_badf(self): os.set_inheritable(fd, False) self.assertEqual(ctx.exception.errno, errno.EBADF) + @requires_os_func('get_inheritable') def test_open(self): fd = os.open(__file__, os.O_RDONLY) self.addCleanup(os.close, fd) From 296a51986fc58f2bf6a90d02d0d0c405c8eac7ea Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:32:01 +0100 Subject: [PATCH 12/80] test_exist_ok_existing_directory, test_exist_ok_s_isgid_directory --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 6865cdc0d8..d7b3b10348 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1616,6 +1616,7 @@ def test_mode(self): self.assertEqual(os.stat(path).st_mode & 0o777, 0o555) self.assertEqual(os.stat(parent).st_mode & 0o777, 0o775) + @requires_os_func('umask') def test_exist_ok_existing_directory(self): path = os.path.join(os_helper.TESTFN, 'dir1') mode = 0o777 @@ -1630,6 +1631,7 @@ def test_exist_ok_existing_directory(self): # Issue #25583: A drive root could raise PermissionError on Windows os.makedirs(os.path.abspath('/'), exist_ok=True) + @requires_os_func('umask') def test_exist_ok_s_isgid_directory(self): path = os.path.join(os_helper.TESTFN, 'dir1') S_ISGID = stat.S_ISGID From 10892051bd97becae7bb01879e56f84d87b36636 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:33:48 +0100 Subject: [PATCH 13/80] check_waitpid --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index d7b3b10348..fa905443bc 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3019,6 +3019,7 @@ def test_getppid(self): # We are the parent of our subprocess self.assertEqual(int(stdout), os.getpid()) + @requires_os_func('spawnv') def check_waitpid(self, code, exitcode, callback=None): if sys.platform == 'win32': # On Windows, os.spawnv() simply joins arguments with spaces: From 11950c82775c73e6bdd2971e85cfbc32f4d25fe2 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:41:58 +0100 Subject: [PATCH 14/80] test_waitstatus_to_exitcode_windows --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index fa905443bc..3c007be28c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3061,6 +3061,8 @@ def test_waitpid_windows(self): code = f'import _winapi; _winapi.ExitProcess({STATUS_CONTROL_C_EXIT})' self.check_waitpid(code, exitcode=STATUS_CONTROL_C_EXIT) + # TODO: RUSTPYTHON (OverflowError: Python int too large to convert to Rust i32) + @unittest.expectedFailure @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') def test_waitstatus_to_exitcode_windows(self): max_exitcode = 2 ** 32 - 1 From cee0ddf273fae80c6d572c4d0747f9fe262a5a9d Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:45:40 +0100 Subject: [PATCH 15/80] test_access_denied --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 3c007be28c..88d32b8e07 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -718,6 +718,8 @@ def test_file_attributes(self): result.st_file_attributes & stat.FILE_ATTRIBUTE_DIRECTORY, stat.FILE_ATTRIBUTE_DIRECTORY) + # TODO: RUSTPYTHON os.stat (PermissionError: [Errno 5] Access is denied. (os error 5)) + @unittest.expectedFailure @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") def test_access_denied(self): # Default to FindFirstFile WIN32_FIND_DATA when access is From 7e0e3559abe37780850f7f436bb057c0aa08c606 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:46:53 +0100 Subject: [PATCH 16/80] test_stat_block_device --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 88d32b8e07..cbf5c2750e 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -741,6 +741,8 @@ def test_access_denied(self): result = os.stat(fname) self.assertNotEqual(result.st_size, 0) + # TODO: RUSTPYTHON os.stat (PermissionError: [Errno 1] Incorrect function. (os error 1)) + @unittest.expectedFailure @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") def test_stat_block_device(self): # bpo-38030: os.stat fails for block devices From 4a9e554efd9d31f3c4e807232b86e3af01c843d6 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:48:05 +0100 Subject: [PATCH 17/80] test_inheritable --- Lib/test/test_os.py | 1 + 1 file changed, 1 insertion(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index cbf5c2750e..4fe9a05661 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2232,6 +2232,7 @@ def test_write(self): def test_writev(self): self.check(os.writev, [b'abc']) + @requires_os_func('get_inheritable') def test_inheritable(self): self.check(os.get_inheritable) self.check(os.set_inheritable, True) From 1291a5ab8f4f2342ed03536c20263bbb3d97e122 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:49:26 +0100 Subject: [PATCH 18/80] test_large_time --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 4fe9a05661..c51116366c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -920,6 +920,8 @@ def get_file_system(self, path): return buf.value # return None if the filesystem is unknown + # TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes') + @unittest.expectedFailure def test_large_time(self): # Many filesystems are limited to the year 2038. At least, the test # pass with NTFS filesystem. From f87d4cd81d2b80b8f7e23cb919672143007f1b5e Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:50:56 +0100 Subject: [PATCH 19/80] test_create_junction, test_unlink_removes_junction --- Lib/test/test_os.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index c51116366c..366c34a323 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2840,6 +2840,8 @@ def tearDown(self): if os.path.lexists(self.junction): os.unlink(self.junction) + # TODO: RUSTPYTHON (AttributeError: module '_winapi' has no attribute 'CreateJunction') + @unittest.expectedFailure def test_create_junction(self): _winapi.CreateJunction(self.junction_target, self.junction) self.assertTrue(os.path.lexists(self.junction)) @@ -2853,6 +2855,8 @@ def test_create_junction(self): self.assertEqual(os.path.normcase("\\\\?\\" + self.junction_target), os.path.normcase(os.readlink(self.junction))) + # TODO: RUSTPYTHON (AttributeError: module '_winapi' has no attribute 'CreateJunction') + @unittest.expectedFailure def test_unlink_removes_junction(self): _winapi.CreateJunction(self.junction_target, self.junction) self.assertTrue(os.path.exists(self.junction)) From af17a33c9975e8a1ca058dcee261ce72169b2d24 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:52:21 +0100 Subject: [PATCH 20/80] test_kill_sigterm, test_kill_int --- Lib/test/test_os.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 366c34a323..462446792d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2479,10 +2479,14 @@ def _kill(self, sig): os.kill(proc.pid, sig) self.assertEqual(proc.wait(), sig) + # TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes') + @unittest.expectedFailure def test_kill_sigterm(self): # SIGTERM doesn't mean anything special, but make sure it works self._kill(signal.SIGTERM) + # TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes') + @unittest.expectedFailure def test_kill_int(self): # os.kill on Windows can take an int which gets set as the exit code self._kill(100) From a0b2f45aaca2e4c5289c5cad7f69876f518bcb61 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:54:21 +0100 Subject: [PATCH 21/80] test_stat_unlink_race --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 462446792d..a3b77fb293 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2919,6 +2919,8 @@ def test_getfinalpathname_handles(self): self.assertEqual(0, handle_delta) + # TODO: RUSTPYTHON os.stat (PermissionError: [Errno 5] Access is denied. (os error 5)) + @unittest.expectedFailure def test_stat_unlink_race(self): # bpo-46785: the implementation of os.stat() falls back to reading # the parent directory if CreateFileW() fails with a permission From 89365e21e125cf6968e7aaf2c21f1e29916c2f04 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:56:19 +0100 Subject: [PATCH 22/80] test_putenv_unsetenv_error --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index a3b77fb293..5eb424e7de 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1131,6 +1131,8 @@ def test_putenv_unsetenv(self): stdout=subprocess.PIPE, text=True) self.assertEqual(proc.stdout.rstrip(), repr(None)) + # TODO: RUSTPYTHON (AssertionError: ValueError not raised by putenv) + @unittest.expectedFailure # On OS X < 10.6, unsetenv() doesn't return a value (bpo-13415). @support.requires_mac_ver(10, 6) def test_putenv_unsetenv_error(self): From 1dfc0a9c952823e1077217456148191eeadc6fa6 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:58:25 +0100 Subject: [PATCH 23/80] test_file_attributes --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5eb424e7de..8afa83a8c7 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -697,6 +697,8 @@ def check_file_attributes(self, result): self.assertTrue(isinstance(result.st_file_attributes, int)) self.assertTrue(0 <= result.st_file_attributes <= 0xFFFFFFFF) + # TODO: RUSTPYTHON os.stat return value doesnt have st_file_attributes attribute + @unittest.expectedFailure @unittest.skipUnless(sys.platform == "win32", "st_file_attributes is Win32 specific") def test_file_attributes(self): From 88051cbd70686e2a1b8d99d4963c4a277eb13691 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 11:59:38 +0100 Subject: [PATCH 24/80] test_fdopen --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 8afa83a8c7..7b0d98ab28 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2168,6 +2168,8 @@ def check(self, f, *args, **kwargs): self.fail("%r didn't raise an OSError with a bad file descriptor" % f) + # TODO: RUSTPYTHON (AssertionError: didn't raise an OSError with a bad file descriptor) + @unittest.expectedFailure def test_fdopen(self): self.check(os.fdopen, encoding="utf-8") From c16a6ea5026a9b51586415b6550e0e1060441388 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 12:04:29 +0100 Subject: [PATCH 25/80] test_fstat, test_fsync --- Lib/test/test_os.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 7b0d98ab28..0c1711ad9c 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2147,8 +2147,13 @@ def test_chmod(self): class TestInvalidFD(unittest.TestCase): - singles = ["fchdir", "dup", "fdatasync", "fstat", - "fstatvfs", "fsync", "tcgetpgrp", "ttyname"] + singles = ["fchdir", "dup", "fdatasync", + # TODO: RUSTPYTHON fstat test (OSError: [Errno 18] There are no more files. (os error 18)) + # "fstat", + "fstatvfs", + # TODO: RUSTPYTHON fsync test (OSError: [Errno 18] There are no more files. (os error 18)) + # "fsync", + "tcgetpgrp", "ttyname"] #singles.append("close") #We omit close because it doesn't raise an exception on some platforms def get_single(f): From d9066414151db6da53561e2f2370dbe1fcb9a4d2 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 12:07:20 +0100 Subject: [PATCH 26/80] test_ftruncate, test_lseek, test_read, test_write --- Lib/test/test_os.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 0c1711ad9c..3b4a5eeeed 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2215,15 +2215,21 @@ def test_fpathconf(self): self.check(os.pathconf, "PC_NAME_MAX") self.check(os.fpathconf, "PC_NAME_MAX") + # TODO: RUSTPYTHON (AssertionError: didn't raise an OSError with a bad file descriptor) + @unittest.expectedFailure @unittest.skipUnless(hasattr(os, 'ftruncate'), 'test needs os.ftruncate()') def test_ftruncate(self): self.check(os.truncate, 0) self.check(os.ftruncate, 0) + # TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files. (os error 18)) + @unittest.expectedFailure @unittest.skipUnless(hasattr(os, 'lseek'), 'test needs os.lseek()') def test_lseek(self): self.check(os.lseek, 0, 0) + # TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files. (os error 18)) + @unittest.expectedFailure @unittest.skipUnless(hasattr(os, 'read'), 'test needs os.read()') def test_read(self): self.check(os.read, 1) @@ -2237,6 +2243,8 @@ def test_readv(self): def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0) + # TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files. (os error 18)) + @unittest.expectedFailure @unittest.skipUnless(hasattr(os, 'write'), 'test needs os.write()') def test_write(self): self.check(os.write, b" ") From f5c7f32ee3aed48a074357003a8a8bf765e3b361 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 12:08:24 +0100 Subject: [PATCH 27/80] test_empty_path --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 3b4a5eeeed..9e7d077c88 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4505,6 +4505,8 @@ def test_fd(self): st = os.stat(entry.name, dir_fd=fd, follow_symlinks=False) self.assertEqual(entry.stat(follow_symlinks=False), st) + # TODO: RUSTPYTHON (AssertionError: FileNotFoundError not raised by scandir) + @unittest.expectedFailure def test_empty_path(self): self.assertRaises(FileNotFoundError, os.scandir, '') From 88a99072cc06e6a1cdb033e4299658ea8920a295 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 12:11:22 +0100 Subject: [PATCH 28/80] test_removed_dir, test_removed_file --- Lib/test/test_os.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 9e7d077c88..b5fbf42024 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4385,6 +4385,8 @@ def test_fspath_protocol_bytes(self): self.assertEqual(fspath, os.path.join(os.fsencode(self.path),bytes_filename)) + # TODO: RYSTPYTHON entry.is_dir() is False + @unittest.expectedFailure def test_removed_dir(self): path = os.path.join(self.path, 'dir') @@ -4407,6 +4409,8 @@ def test_removed_dir(self): self.assertRaises(FileNotFoundError, entry.stat) self.assertRaises(FileNotFoundError, entry.stat, follow_symlinks=False) + # TODO: RYSTPYTHON entry.is_file() is False + @unittest.expectedFailure def test_removed_file(self): entry = self.create_file_entry() os.unlink(entry.path) From 961a53e5fe46202c4dceb91153b1725c7752ff13 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 12:15:43 +0100 Subject: [PATCH 29/80] test_urandom_subprocess, test_urandom_fd_closed, test_urandom_fd_reopened --- Lib/test/test_os.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index b5fbf42024..5e6b08ee9b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1826,6 +1826,8 @@ def get_urandom_subprocess(self, count): self.assertEqual(len(stdout), count) return stdout + # TODO: RUSTPYTHON on Windows (ModuleNotFoundError: No module named 'os') + @unittest.expectedFailure def test_urandom_subprocess(self): data1 = self.get_urandom_subprocess(16) data2 = self.get_urandom_subprocess(16) @@ -1910,6 +1912,8 @@ def test_urandom_failure(self): """ assert_python_ok('-c', code) + # TODO: RUSTPYTHON on Windows (ModuleNotFoundError: No module named 'os') + @unittest.expectedFailure def test_urandom_fd_closed(self): # Issue #21207: urandom() should reopen its fd to /dev/urandom if # closed. @@ -1924,6 +1928,8 @@ def test_urandom_fd_closed(self): """ rc, out, err = assert_python_ok('-Sc', code) + # TODO: RUSTPYTHON on Windows (ModuleNotFoundError: No module named 'os') + @unittest.expectedFailure def test_urandom_fd_reopened(self): # Issue #21207: urandom() should detect its fd to /dev/urandom # changed to something else, and reopen it. From 69dec52e9d6a1f76d8104480288ac5f94d3cb4ce Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 12:20:40 +0100 Subject: [PATCH 30/80] test_utime, test_utime_directory, test_utime_current, test_utime_current_old --- Lib/test/test_os.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5e6b08ee9b..8805600879 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -802,6 +802,8 @@ def _test_utime(self, set_time, filename=None): self.assertEqual(st.st_atime_ns, atime_ns) self.assertEqual(st.st_mtime_ns, mtime_ns) + # TODO: RUSTPYTHON (AssertionError: 2.002003 != 1.002003 within 1e-06 delta (1.0000000000000002 difference)) + @unittest.expectedFailure def test_utime(self): def set_time(filename, ns): # test the ns keyword parameter @@ -869,6 +871,8 @@ def set_time(filename, ns): os.utime(name, dir_fd=dirfd, ns=ns) self._test_utime(set_time) + # TODO: RUSTPYTHON (AssertionError: 2.002003 != 1.002003 within 1e-06 delta (1.0000000000000002 difference)) + @unittest.expectedFailure def test_utime_directory(self): def set_time(filename, ns): # test calling os.utime() on a directory @@ -897,12 +901,16 @@ def _test_utime_current(self, set_time): self.assertAlmostEqual(st.st_mtime, current, delta=delta, msg=msg) + # TODO: RUSTPYTHON (AssertionError: 3359485824.516508 != 1679742912.516503 within 0.05 delta (1679742912.000005 difference) : st_time=3359485824.516508, current=1679742912.516503, dt=1679742912.000005) + @unittest.expectedFailure def test_utime_current(self): def set_time(filename): # Set to the current time in the new way os.utime(self.fname) self._test_utime_current(set_time) + # TODO: RUSTPYTHON (AssertionError: 3359485824.5186944 != 1679742912.5186892 within 0.05 delta (1679742912.0000052 difference) : st_time=3359485824.5186944, current=1679742912.5186892, dt=1679742912.0000052) + @unittest.expectedFailure def test_utime_current_old(self): def set_time(filename): # Set to the current time in the old explicit way. From 0e68f9763f862ec3fdff5f6adb6837eeec76bd00 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 12:22:25 +0100 Subject: [PATCH 31/80] test_utime_invalid_arguments --- Lib/test/test_os.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 8805600879..8f6a707ca6 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -942,6 +942,8 @@ def test_large_time(self): os.utime(self.fname, (large, large)) self.assertEqual(os.stat(self.fname).st_mtime, large) + # TODO: RUSTPYTHON (AssertionError: NotImplementedError not raised) + @unittest.expectedFailure def test_utime_invalid_arguments(self): # seconds and nanoseconds parameters are mutually exclusive with self.assertRaises(ValueError): From ca2aab22f0a511e20fae0c1cd5e634d8d601b9a7 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:10:39 +0100 Subject: [PATCH 32/80] test_file_attributes -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 8f6a707ca6..044ccb35cb 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -697,8 +697,7 @@ def check_file_attributes(self, result): self.assertTrue(isinstance(result.st_file_attributes, int)) self.assertTrue(0 <= result.st_file_attributes <= 0xFFFFFFFF) - # TODO: RUSTPYTHON os.stat return value doesnt have st_file_attributes attribute - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.stat return value doesnt have st_file_attributes attribute") @unittest.skipUnless(sys.platform == "win32", "st_file_attributes is Win32 specific") def test_file_attributes(self): From e6b6137d066a4d22b010a7ac1fdb9ad2af7b1534 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:11:36 +0100 Subject: [PATCH 33/80] test_access_denied -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 044ccb35cb..1da4de7287 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -719,8 +719,7 @@ def test_file_attributes(self): result.st_file_attributes & stat.FILE_ATTRIBUTE_DIRECTORY, stat.FILE_ATTRIBUTE_DIRECTORY) - # TODO: RUSTPYTHON os.stat (PermissionError: [Errno 5] Access is denied. (os error 5)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.stat (PermissionError: [Errno 5] Access is denied.)") @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") def test_access_denied(self): # Default to FindFirstFile WIN32_FIND_DATA when access is From 1ea5b58509f44d61614a8ec6324f866db874606c Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:15:35 +0100 Subject: [PATCH 34/80] test_stat_block_device -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 1da4de7287..cedd381db6 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -741,8 +741,7 @@ def test_access_denied(self): result = os.stat(fname) self.assertNotEqual(result.st_size, 0) - # TODO: RUSTPYTHON os.stat (PermissionError: [Errno 1] Incorrect function. (os error 1)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.stat (PermissionError: [Errno 1] Incorrect function.)") @unittest.skipUnless(sys.platform == "win32", "Win32 specific tests") def test_stat_block_device(self): # bpo-38030: os.stat fails for block devices From 408a5450d0c483c3e7855797574ce216f304879e Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:16:35 +0100 Subject: [PATCH 35/80] test_utime -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index cedd381db6..03d498cfa0 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -799,8 +799,7 @@ def _test_utime(self, set_time, filename=None): self.assertEqual(st.st_atime_ns, atime_ns) self.assertEqual(st.st_mtime_ns, mtime_ns) - # TODO: RUSTPYTHON (AssertionError: 2.002003 != 1.002003 within 1e-06 delta (1.0000000000000002 difference)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: 2.002003 != 1.002003 within 1e-06 delta (1.0000000000000002 difference))") def test_utime(self): def set_time(filename, ns): # test the ns keyword parameter From f3f813f2546d2d7f23d214307dad71e27a5b3b3c Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:17:21 +0100 Subject: [PATCH 36/80] test_utime_directory -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 03d498cfa0..15a9f6bf12 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -867,8 +867,7 @@ def set_time(filename, ns): os.utime(name, dir_fd=dirfd, ns=ns) self._test_utime(set_time) - # TODO: RUSTPYTHON (AssertionError: 2.002003 != 1.002003 within 1e-06 delta (1.0000000000000002 difference)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: 2.002003 != 1.002003 within 1e-06 delta (1.0000000000000002 difference))") def test_utime_directory(self): def set_time(filename, ns): # test calling os.utime() on a directory From 9c07fac155336a5d74d21e6d9d4da979bd7e1dd5 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:18:07 +0100 Subject: [PATCH 37/80] test_utime_current -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 15a9f6bf12..6e7f9c67cb 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -896,8 +896,7 @@ def _test_utime_current(self, set_time): self.assertAlmostEqual(st.st_mtime, current, delta=delta, msg=msg) - # TODO: RUSTPYTHON (AssertionError: 3359485824.516508 != 1679742912.516503 within 0.05 delta (1679742912.000005 difference) : st_time=3359485824.516508, current=1679742912.516503, dt=1679742912.000005) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: 3359485824.516508 != 1679742912.516503 within 0.05 delta (1679742912.000005 difference) : st_time=3359485824.516508, current=1679742912.516503, dt=1679742912.000005)") def test_utime_current(self): def set_time(filename): # Set to the current time in the new way From fda05ba0fffbec5f7bc1a25fb4cb33372407851b Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:18:42 +0100 Subject: [PATCH 38/80] test_utime_current_old -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 6e7f9c67cb..614a97e0b8 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -903,8 +903,7 @@ def set_time(filename): os.utime(self.fname) self._test_utime_current(set_time) - # TODO: RUSTPYTHON (AssertionError: 3359485824.5186944 != 1679742912.5186892 within 0.05 delta (1679742912.0000052 difference) : st_time=3359485824.5186944, current=1679742912.5186892, dt=1679742912.0000052) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: 3359485824.5186944 != 1679742912.5186892 within 0.05 delta (1679742912.0000052 difference) : st_time=3359485824.5186944, current=1679742912.5186892, dt=1679742912.0000052)") def test_utime_current_old(self): def set_time(filename): # Set to the current time in the old explicit way. From 5e252c5399bbcca1f4c68bef11bc5dd2876e3f4a Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:19:21 +0100 Subject: [PATCH 39/80] test_large_time -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 614a97e0b8..bc23f582e4 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -923,8 +923,7 @@ def get_file_system(self, path): return buf.value # return None if the filesystem is unknown - # TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes')") def test_large_time(self): # Many filesystems are limited to the year 2038. At least, the test # pass with NTFS filesystem. From bce276e5db98d1df74b6bd3cdbf9ec47afa9f2d0 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:20:10 +0100 Subject: [PATCH 40/80] test_utime_invalid_arguments -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index bc23f582e4..7769b307da 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -934,8 +934,7 @@ def test_large_time(self): os.utime(self.fname, (large, large)) self.assertEqual(os.stat(self.fname).st_mtime, large) - # TODO: RUSTPYTHON (AssertionError: NotImplementedError not raised) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: NotImplementedError not raised)") def test_utime_invalid_arguments(self): # seconds and nanoseconds parameters are mutually exclusive with self.assertRaises(ValueError): From ae71c46df2b2550324fb8aa29624d0c80b07a83d Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:21:07 +0100 Subject: [PATCH 41/80] test_putenv_unsetenv_error -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 7769b307da..ad48f8cca4 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1134,8 +1134,7 @@ def test_putenv_unsetenv(self): stdout=subprocess.PIPE, text=True) self.assertEqual(proc.stdout.rstrip(), repr(None)) - # TODO: RUSTPYTHON (AssertionError: ValueError not raised by putenv) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: ValueError not raised by putenv)") # On OS X < 10.6, unsetenv() doesn't return a value (bpo-13415). @support.requires_mac_ver(10, 6) def test_putenv_unsetenv_error(self): From a7ef291b58ce8319e8292d3fee546cf621cf1d5c Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:22:59 +0100 Subject: [PATCH 42/80] test_exist_ok_existing_directory -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index ad48f8cca4..08ca84a54d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1626,7 +1626,7 @@ def test_mode(self): self.assertEqual(os.stat(path).st_mode & 0o777, 0o555) self.assertEqual(os.stat(parent).st_mode & 0o777, 0o775) - @requires_os_func('umask') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.umask not implemented") def test_exist_ok_existing_directory(self): path = os.path.join(os_helper.TESTFN, 'dir1') mode = 0o777 From f5c400862812bbb86aac4f715bc9213c0f41600c Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:23:44 +0100 Subject: [PATCH 43/80] test_exist_ok_s_isgid_directory -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 08ca84a54d..ee5693f1e5 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1641,7 +1641,7 @@ def test_exist_ok_existing_directory(self): # Issue #25583: A drive root could raise PermissionError on Windows os.makedirs(os.path.abspath('/'), exist_ok=True) - @requires_os_func('umask') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.umask not implemented") def test_exist_ok_s_isgid_directory(self): path = os.path.join(os_helper.TESTFN, 'dir1') S_ISGID = stat.S_ISGID From ace1a5e8210bc79c0474e95a0a9dab3ba43bc930 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:24:55 +0100 Subject: [PATCH 44/80] test_urandom_subprocess -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index ee5693f1e5..1a015bd0f9 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1826,8 +1826,7 @@ def get_urandom_subprocess(self, count): self.assertEqual(len(stdout), count) return stdout - # TODO: RUSTPYTHON on Windows (ModuleNotFoundError: No module named 'os') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (ModuleNotFoundError: No module named 'os'") def test_urandom_subprocess(self): data1 = self.get_urandom_subprocess(16) data2 = self.get_urandom_subprocess(16) From 54c98113a05df205bb4c9512eb1248aaef6adcf9 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:25:32 +0100 Subject: [PATCH 45/80] test_urandom_fd_reopened -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 1a015bd0f9..ed0013aa2e 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1927,8 +1927,7 @@ def test_urandom_fd_closed(self): """ rc, out, err = assert_python_ok('-Sc', code) - # TODO: RUSTPYTHON on Windows (ModuleNotFoundError: No module named 'os') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (ModuleNotFoundError: No module named 'os'") def test_urandom_fd_reopened(self): # Issue #21207: urandom() should detect its fd to /dev/urandom # changed to something else, and reopen it. From 5ee7e22d5ad1e3cd8431edffc941424100d34eee Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:27:23 +0100 Subject: [PATCH 46/80] test_execvpe_with_bad_arglist -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index ed0013aa2e..cbaa6b90f7 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2019,8 +2019,7 @@ def test_execv_with_bad_arglist(self): self.assertRaises(ValueError, os.execv, 'notepad', ('',)) self.assertRaises(ValueError, os.execv, 'notepad', ['']) - # NOTE: os.execvpe but calls os.execve inside - @requires_os_func('execve') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented") def test_execvpe_with_bad_arglist(self): self.assertRaises(ValueError, os.execvpe, 'notepad', [], None) self.assertRaises(ValueError, os.execvpe, 'notepad', [], {}) From 0478b28a33da317103e9c830d49b3e14c3828ce6 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:28:08 +0100 Subject: [PATCH 47/80] test_execve_invalid_env -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index cbaa6b90f7..939025473d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2079,7 +2079,7 @@ def test_internal_execvpe_str(self): if os.name != "nt": self._test_internal_execvpe(bytes) - @requires_os_func('execve') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented") def test_execve_invalid_env(self): args = [sys.executable, '-c', 'pass'] From 89ce647654dd3f01b9cc1643e4db136fde5b4572 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:28:56 +0100 Subject: [PATCH 48/80] test_execve_with_empty_path -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 939025473d..6f0676e480 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2101,7 +2101,7 @@ def test_execve_invalid_env(self): with self.assertRaises(ValueError): os.execve(args[0], args, newenv) - @requires_os_func('execve') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented") @unittest.skipUnless(sys.platform == "win32", "Win32-specific test") def test_execve_with_empty_path(self): # bpo-32890: Check GetLastError() misuse From 20d4ce3d232d5d996ac92b9aa039e51b2588b43d Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:29:47 +0100 Subject: [PATCH 49/80] test_fdopen -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 6f0676e480..721c616107 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2176,8 +2176,7 @@ def check(self, f, *args, **kwargs): self.fail("%r didn't raise an OSError with a bad file descriptor" % f) - # TODO: RUSTPYTHON (AssertionError: didn't raise an OSError with a bad file descriptor) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: didn't raise an OSError with a bad file descriptor)") def test_fdopen(self): self.check(os.fdopen, encoding="utf-8") From 96e79901aec1f067ccacf9b6587dba83eaa2fcaa Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:31:36 +0100 Subject: [PATCH 50/80] test_ftruncate -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 721c616107..95f6aedfd4 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2217,8 +2217,7 @@ def test_fpathconf(self): self.check(os.pathconf, "PC_NAME_MAX") self.check(os.fpathconf, "PC_NAME_MAX") - # TODO: RUSTPYTHON (AssertionError: didn't raise an OSError with a bad file descriptor) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: didn't raise an OSError with a bad file descriptor)") @unittest.skipUnless(hasattr(os, 'ftruncate'), 'test needs os.ftruncate()') def test_ftruncate(self): self.check(os.truncate, 0) From d605872c9a8fe7421c13558664b23c739f73835e Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:32:15 +0100 Subject: [PATCH 51/80] test_lseek -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 95f6aedfd4..9ef1e7b440 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2223,8 +2223,7 @@ def test_ftruncate(self): self.check(os.truncate, 0) self.check(os.ftruncate, 0) - # TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files. (os error 18)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.") @unittest.skipUnless(hasattr(os, 'lseek'), 'test needs os.lseek()') def test_lseek(self): self.check(os.lseek, 0, 0) From 8ce910548cf702658c104d902b2d4c3e51dbdf21 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:33:07 +0100 Subject: [PATCH 52/80] test_read -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 9ef1e7b440..20ec17fc1b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2228,8 +2228,7 @@ def test_ftruncate(self): def test_lseek(self): self.check(os.lseek, 0, 0) - # TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files. (os error 18)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.") @unittest.skipUnless(hasattr(os, 'read'), 'test needs os.read()') def test_read(self): self.check(os.read, 1) From bbac9bdf3fec12c0db9b6346e2a8cc057f45beeb Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:33:43 +0100 Subject: [PATCH 53/80] test_write -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 20ec17fc1b..717dae92f8 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2242,8 +2242,7 @@ def test_readv(self): def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0) - # TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files. (os error 18)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.") @unittest.skipUnless(hasattr(os, 'write'), 'test needs os.write()') def test_write(self): self.check(os.write, b" ") From 3a3da4dd76fcff8e733c3f89b54f5c84d0e9a8d9 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:34:53 +0100 Subject: [PATCH 54/80] test_inheritable -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 717dae92f8..dd6b6dbc0e 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2251,7 +2251,7 @@ def test_write(self): def test_writev(self): self.check(os.writev, [b'abc']) - @requires_os_func('get_inheritable') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") def test_inheritable(self): self.check(os.get_inheritable) self.check(os.set_inheritable, True) From 25336e945ae69b3034fe95e5fd48040f2b9f86ab Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:36:11 +0100 Subject: [PATCH 55/80] test_kill_sigterm -> expectedFailureIfWindows --- Lib/test/test_os.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index dd6b6dbc0e..a29d5caf21 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2223,12 +2223,12 @@ def test_ftruncate(self): self.check(os.truncate, 0) self.check(os.ftruncate, 0) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.)") @unittest.skipUnless(hasattr(os, 'lseek'), 'test needs os.lseek()') def test_lseek(self): self.check(os.lseek, 0, 0) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.)") @unittest.skipUnless(hasattr(os, 'read'), 'test needs os.read()') def test_read(self): self.check(os.read, 1) @@ -2242,7 +2242,7 @@ def test_readv(self): def test_tcsetpgrpt(self): self.check(os.tcsetpgrp, 0) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OSError: [Errno 18] There are no more files.)") @unittest.skipUnless(hasattr(os, 'write'), 'test needs os.write()') def test_write(self): self.check(os.write, b" ") @@ -2496,8 +2496,7 @@ def _kill(self, sig): os.kill(proc.pid, sig) self.assertEqual(proc.wait(), sig) - # TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes')") def test_kill_sigterm(self): # SIGTERM doesn't mean anything special, but make sure it works self._kill(signal.SIGTERM) From f86875172797cc0c7a0461ec5f295639ec2f6beb Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:36:36 +0100 Subject: [PATCH 56/80] test_kill_int -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index a29d5caf21..65193c123b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2501,8 +2501,7 @@ def test_kill_sigterm(self): # SIGTERM doesn't mean anything special, but make sure it works self._kill(signal.SIGTERM) - # TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (ModuleNotFoundError: No module named '_ctypes')") def test_kill_int(self): # os.kill on Windows can take an int which gets set as the exit code self._kill(100) From de530e21b14d11a5e5bf27eb2b8948f41dabfa1d Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:37:26 +0100 Subject: [PATCH 57/80] test_create_junction -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 65193c123b..fe3fd60b57 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2859,8 +2859,7 @@ def tearDown(self): if os.path.lexists(self.junction): os.unlink(self.junction) - # TODO: RUSTPYTHON (AttributeError: module '_winapi' has no attribute 'CreateJunction') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AttributeError: module '_winapi' has no attribute 'CreateJunction')") def test_create_junction(self): _winapi.CreateJunction(self.junction_target, self.junction) self.assertTrue(os.path.lexists(self.junction)) From cd3a61030a529565c07a77bfb93a8be17201e373 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:38:03 +0100 Subject: [PATCH 58/80] test_unlink_removes_junction -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index fe3fd60b57..847c049ee1 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2873,8 +2873,7 @@ def test_create_junction(self): self.assertEqual(os.path.normcase("\\\\?\\" + self.junction_target), os.path.normcase(os.readlink(self.junction))) - # TODO: RUSTPYTHON (AttributeError: module '_winapi' has no attribute 'CreateJunction') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AttributeError: module '_winapi' has no attribute 'CreateJunction')") def test_unlink_removes_junction(self): _winapi.CreateJunction(self.junction_target, self.junction) self.assertTrue(os.path.exists(self.junction)) From 5ba2f820e7432825aa163bca66f8655937a3f852 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:38:50 +0100 Subject: [PATCH 59/80] test_stat_unlink_race -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 847c049ee1..662ca22326 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2932,8 +2932,7 @@ def test_getfinalpathname_handles(self): self.assertEqual(0, handle_delta) - # TODO: RUSTPYTHON os.stat (PermissionError: [Errno 5] Access is denied. (os error 5)) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.stat (PermissionError: [Errno 5] Access is denied.)") def test_stat_unlink_race(self): # bpo-46785: the implementation of os.stat() falls back to reading # the parent directory if CreateFileW() fails with a permission From 6e5a6f2d3184a5ab0ef03b91f674d65a973b0044 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:40:16 +0100 Subject: [PATCH 60/80] test_waitpid_windows -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 662ca22326..6d457c3b1f 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3048,7 +3048,6 @@ def test_getppid(self): # We are the parent of our subprocess self.assertEqual(int(stdout), os.getpid()) - @requires_os_func('spawnv') def check_waitpid(self, code, exitcode, callback=None): if sys.platform == 'win32': # On Windows, os.spawnv() simply joins arguments with spaces: @@ -3082,6 +3081,7 @@ def test_waitstatus_to_exitcode(self): with self.assertRaises(TypeError): os.waitstatus_to_exitcode(0.0) + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.spawnv not implemented") @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') def test_waitpid_windows(self): # bpo-40138: test os.waitpid() and os.waitstatus_to_exitcode() From 8d4aa130700bd6e68cc089b765aabc76374f8668 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:41:08 +0100 Subject: [PATCH 61/80] test_waitstatus_to_exitcode -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 6d457c3b1f..0d093c4a4b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3071,8 +3071,7 @@ def check_waitpid(self, code, exitcode, callback=None): def test_waitpid(self): self.check_waitpid(code='pass', exitcode=0) - # TODO: RUSTPYTHON (AttributeError: module 'os' has no attribute 'spawnv') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.spawnv not implemented") def test_waitstatus_to_exitcode(self): exitcode = 23 code = f'import sys; sys.exit({exitcode})' From 9e06414b7b3682d55d2c0ed4e66fa9e12552f39e Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:41:30 +0100 Subject: [PATCH 62/80] test_waitpid -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 0d093c4a4b..94795730c3 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3066,8 +3066,7 @@ def check_waitpid(self, code, exitcode, callback=None): self.assertEqual(os.waitstatus_to_exitcode(status), exitcode) self.assertEqual(pid2, pid) - # TODO: RUSTPYTHON (AttributeError: module 'os' has no attribute 'spawnv') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.spawnv not implemented") def test_waitpid(self): self.check_waitpid(code='pass', exitcode=0) From 612d9b72b539f8860ef82ad9c8e6893a4ad5108a Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:42:36 +0100 Subject: [PATCH 63/80] test_urandom_fd_closed -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 94795730c3..d695f0f813 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1911,8 +1911,7 @@ def test_urandom_failure(self): """ assert_python_ok('-c', code) - # TODO: RUSTPYTHON on Windows (ModuleNotFoundError: No module named 'os') - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON on Windows (ModuleNotFoundError: No module named 'os')") def test_urandom_fd_closed(self): # Issue #21207: urandom() should reopen its fd to /dev/urandom if # closed. From a55b244305a3024440cf7d0f3f636f2ae3892699 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:44:21 +0100 Subject: [PATCH 64/80] revert test_waitpid --- Lib/test/test_os.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index d695f0f813..62cd245df0 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3065,7 +3065,8 @@ def check_waitpid(self, code, exitcode, callback=None): self.assertEqual(os.waitstatus_to_exitcode(status), exitcode) self.assertEqual(pid2, pid) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.spawnv not implemented") + # TODO: RUSTPYTHON (AttributeError: module 'os' has no attribute 'spawnv') + @unittest.expectedFailure def test_waitpid(self): self.check_waitpid(code='pass', exitcode=0) From b8f8092b38eb8904f4a99113576ba4ea1fac4127 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:44:47 +0100 Subject: [PATCH 65/80] revert test_waitstatus_to_exitcode --- Lib/test/test_os.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 62cd245df0..463ef7a0d8 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3070,7 +3070,8 @@ def check_waitpid(self, code, exitcode, callback=None): def test_waitpid(self): self.check_waitpid(code='pass', exitcode=0) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.spawnv not implemented") + # TODO: RUSTPYTHON (AttributeError: module 'os' has no attribute 'spawnv') + @unittest.expectedFailure def test_waitstatus_to_exitcode(self): exitcode = 23 code = f'import sys; sys.exit({exitcode})' From 1f96e5289479df08454996e1bca1d3150f5079a6 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:45:50 +0100 Subject: [PATCH 66/80] test_waitstatus_to_exitcode_windows -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 463ef7a0d8..19a661c51b 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3089,8 +3089,7 @@ def test_waitpid_windows(self): code = f'import _winapi; _winapi.ExitProcess({STATUS_CONTROL_C_EXIT})' self.check_waitpid(code, exitcode=STATUS_CONTROL_C_EXIT) - # TODO: RUSTPYTHON (OverflowError: Python int too large to convert to Rust i32) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (OverflowError: Python int too large to convert to Rust i32)") @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') def test_waitstatus_to_exitcode_windows(self): max_exitcode = 2 ** 32 - 1 From 4c3d415a5d839dc072bea8282f3067611a773dec Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:46:39 +0100 Subject: [PATCH 67/80] test_removed_dir -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 19a661c51b..50ce784c6d 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4376,8 +4376,7 @@ def test_fspath_protocol_bytes(self): self.assertEqual(fspath, os.path.join(os.fsencode(self.path),bytes_filename)) - # TODO: RYSTPYTHON entry.is_dir() is False - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON entry.is_dir() is False") def test_removed_dir(self): path = os.path.join(self.path, 'dir') From 0f162c8b9dd70842e0af53caae1f25b6cfb0d097 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:47:25 +0100 Subject: [PATCH 68/80] test_removed_file -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 50ce784c6d..7ccf4547eb 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4399,8 +4399,7 @@ def test_removed_dir(self): self.assertRaises(FileNotFoundError, entry.stat) self.assertRaises(FileNotFoundError, entry.stat, follow_symlinks=False) - # TODO: RYSTPYTHON entry.is_file() is False - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON entry.is_file() is False") def test_removed_file(self): entry = self.create_file_entry() os.unlink(entry.path) From 25a452efd1efaaf0f7acab0bcb94ee4a461d4cba Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:48:03 +0100 Subject: [PATCH 69/80] test_empty_path -> expectedFailureIfWindows --- Lib/test/test_os.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 7ccf4547eb..5d92fcf888 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4498,8 +4498,7 @@ def test_fd(self): st = os.stat(entry.name, dir_fd=fd, follow_symlinks=False) self.assertEqual(entry.stat(follow_symlinks=False), st) - # TODO: RUSTPYTHON (AssertionError: FileNotFoundError not raised by scandir) - @unittest.expectedFailure + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON (AssertionError: FileNotFoundError not raised by scandir)") def test_empty_path(self): self.assertRaises(FileNotFoundError, os.scandir, '') From c5bd4469638f3f866da10392cfc46546f78b7f2a Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:49:55 +0100 Subject: [PATCH 70/80] test_get_set_inheritable -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 5d92fcf888..9c9de5e577 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -3977,7 +3977,7 @@ def test_cpu_count(self): class FDInheritanceTests(unittest.TestCase): - @requires_os_func('get_inheritable') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") def test_get_set_inheritable(self): fd = os.open(__file__, os.O_RDONLY) self.addCleanup(os.close, fd) From 0d1e40f310456256b7e277681b20fbdd0572aa33 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:50:34 +0100 Subject: [PATCH 71/80] test_get_set_inheritable_badf -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 9c9de5e577..209dc7a695 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4022,7 +4022,7 @@ def test_get_set_inheritable_o_path(self): os.set_inheritable(fd, False) self.assertEqual(os.get_inheritable(fd), False) - @requires_os_func('get_inheritable') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") def test_get_set_inheritable_badf(self): fd = os_helper.make_bad_fd() From 4876af12d41de117809a4afd9a6452d24e897077 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:51:14 +0100 Subject: [PATCH 72/80] test_open -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 209dc7a695..c8e4d1a270 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4038,7 +4038,7 @@ def test_get_set_inheritable_badf(self): os.set_inheritable(fd, False) self.assertEqual(ctx.exception.errno, errno.EBADF) - @requires_os_func('get_inheritable') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") def test_open(self): fd = os.open(__file__, os.O_RDONLY) self.addCleanup(os.close, fd) From 955b4807694382ae69cb9aca503eb8e4b5255954 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:52:01 +0100 Subject: [PATCH 73/80] test_dup_nul -> expectedFailureIfWindows --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index c8e4d1a270..67940c26ed 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -4067,7 +4067,7 @@ def test_dup_standard_stream(self): self.addCleanup(os.close, fd) self.assertGreater(fd, 0) - @requires_os_func('dup') + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.dup not implemented") @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') def test_dup_nul(self): # os.dup() was creating inheritable fds for character files. From 6ccb320959a8666d420bb06b4ae334e3f2b5db96 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 17:53:32 +0100 Subject: [PATCH 74/80] add NOTE to comment --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 67940c26ed..e585927404 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1987,7 +1987,7 @@ def mock_execve(name, *args): try: orig_execv = os.execv - # os.execve not implemented yet for all platforms + # NOTE: os.execve not implemented yet for all platforms orig_execve = getattr(os, "execve", None) orig_defpath = os.defpath os.execv = mock_execv From d87afe1d6e7407d2c59a498cbf17bd54ebafd94f Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 18:09:47 +0100 Subject: [PATCH 75/80] test_closerange -> skipIf --- Lib/test/test_os.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index e585927404..d339ab5445 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -186,7 +186,7 @@ def test_access(self): os.close(f) self.assertTrue(os.access(os_helper.TESTFN, os.W_OK)) - @requires_os_func('dup') + @unittest.skipIf(sys.platform == "win32", "TODO: RUSTPYTHON, BrokenPipeError: (32, 'The process cannot access the file because it is being used by another process. (os error 32)')") def test_closerange(self): first = os.open(os_helper.TESTFN, os.O_CREAT|os.O_RDWR) # We must allocate two consecutive file descriptors, otherwise From 46b0813ead65dc9913d90de38f92c3b7846de1ff Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 18:25:52 +0100 Subject: [PATCH 76/80] test_fstat, test_fsync -> expectedFailureIfWindows --- Lib/test/test_os.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index d339ab5445..7d8f92c5ab 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2149,13 +2149,8 @@ def test_chmod(self): class TestInvalidFD(unittest.TestCase): - singles = ["fchdir", "dup", "fdatasync", - # TODO: RUSTPYTHON fstat test (OSError: [Errno 18] There are no more files. (os error 18)) - # "fstat", - "fstatvfs", - # TODO: RUSTPYTHON fsync test (OSError: [Errno 18] There are no more files. (os error 18)) - # "fsync", - "tcgetpgrp", "ttyname"] + singles = ["fchdir", "dup", "fdatasync", "fstat", + "fstatvfs", "fsync", "tcgetpgrp", "ttyname"] #singles.append("close") #We omit close because it doesn't raise an exception on some platforms def get_single(f): @@ -2164,7 +2159,10 @@ def helper(self): self.check(getattr(os, f)) return helper for f in singles: - locals()["test_"+f] = get_single(f) + if f in ("fstat", "fsync"): + locals()["test_"+f] = unittest.expectedFailureIfWindows("TODO: RUSTPYTHON fstat test (OSError: [Errno 18] There are no more files.")(get_single(f)) + else: + locals()["test_"+f] = get_single(f) def check(self, f, *args, **kwargs): try: From 9ec3c6e0dd6368bcb4949b1a31adb898d72c89b0 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 18:32:04 +0100 Subject: [PATCH 77/80] adjust comment `os.* not implemented` -> `os.* not implemented yet for all platforms` --- Lib/test/test_os.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 7d8f92c5ab..1e043174b1 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -1626,7 +1626,7 @@ def test_mode(self): self.assertEqual(os.stat(path).st_mode & 0o777, 0o555) self.assertEqual(os.stat(parent).st_mode & 0o777, 0o775) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.umask not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.umask not implemented yet for all platforms") def test_exist_ok_existing_directory(self): path = os.path.join(os_helper.TESTFN, 'dir1') mode = 0o777 @@ -1641,7 +1641,7 @@ def test_exist_ok_existing_directory(self): # Issue #25583: A drive root could raise PermissionError on Windows os.makedirs(os.path.abspath('/'), exist_ok=True) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.umask not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.umask not implemented yet for all platforms") def test_exist_ok_s_isgid_directory(self): path = os.path.join(os_helper.TESTFN, 'dir1') S_ISGID = stat.S_ISGID @@ -1987,7 +1987,7 @@ def mock_execve(name, *args): try: orig_execv = os.execv - # NOTE: os.execve not implemented yet for all platforms + # NOTE: RUSTPYTHON os.execve not implemented yet for all platforms orig_execve = getattr(os, "execve", None) orig_defpath = os.defpath os.execv = mock_execv @@ -2018,7 +2018,7 @@ def test_execv_with_bad_arglist(self): self.assertRaises(ValueError, os.execv, 'notepad', ('',)) self.assertRaises(ValueError, os.execv, 'notepad', ['']) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented yet for all platforms") def test_execvpe_with_bad_arglist(self): self.assertRaises(ValueError, os.execvpe, 'notepad', [], None) self.assertRaises(ValueError, os.execvpe, 'notepad', [], {}) @@ -2078,7 +2078,7 @@ def test_internal_execvpe_str(self): if os.name != "nt": self._test_internal_execvpe(bytes) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented yet for all platforms") def test_execve_invalid_env(self): args = [sys.executable, '-c', 'pass'] @@ -2100,7 +2100,7 @@ def test_execve_invalid_env(self): with self.assertRaises(ValueError): os.execve(args[0], args, newenv) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.execve not implemented yet for all platforms") @unittest.skipUnless(sys.platform == "win32", "Win32-specific test") def test_execve_with_empty_path(self): # bpo-32890: Check GetLastError() misuse @@ -2248,7 +2248,7 @@ def test_write(self): def test_writev(self): self.check(os.writev, [b'abc']) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented yet for all platforms") def test_inheritable(self): self.check(os.get_inheritable) self.check(os.set_inheritable, True) @@ -3078,7 +3078,7 @@ def test_waitstatus_to_exitcode(self): with self.assertRaises(TypeError): os.waitstatus_to_exitcode(0.0) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.spawnv not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.spawnv not implemented yet for all platforms") @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') def test_waitpid_windows(self): # bpo-40138: test os.waitpid() and os.waitstatus_to_exitcode() @@ -3975,7 +3975,7 @@ def test_cpu_count(self): class FDInheritanceTests(unittest.TestCase): - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented yet for all platforms") def test_get_set_inheritable(self): fd = os.open(__file__, os.O_RDONLY) self.addCleanup(os.close, fd) @@ -4020,7 +4020,7 @@ def test_get_set_inheritable_o_path(self): os.set_inheritable(fd, False) self.assertEqual(os.get_inheritable(fd), False) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented yet for all platforms") def test_get_set_inheritable_badf(self): fd = os_helper.make_bad_fd() @@ -4036,7 +4036,7 @@ def test_get_set_inheritable_badf(self): os.set_inheritable(fd, False) self.assertEqual(ctx.exception.errno, errno.EBADF) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.get_inheritable not implemented yet for all platforms") def test_open(self): fd = os.open(__file__, os.O_RDONLY) self.addCleanup(os.close, fd) @@ -4065,7 +4065,7 @@ def test_dup_standard_stream(self): self.addCleanup(os.close, fd) self.assertGreater(fd, 0) - @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.dup not implemented") + @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON os.dup not implemented yet for all platforms") @unittest.skipUnless(sys.platform == 'win32', 'win32-specific test') def test_dup_nul(self): # os.dup() was creating inheritable fds for character files. From a3baa13cbaa891632dece98fb7b1f4fdb54624c2 Mon Sep 17 00:00:00 2001 From: Dmitry Erlikh Date: Sat, 25 Mar 2023 19:19:10 +0100 Subject: [PATCH 78/80] add comment for generated tests in TestInvalidFD --- Lib/test/test_os.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py index 1e043174b1..34afabefe3 100644 --- a/Lib/test/test_os.py +++ b/Lib/test/test_os.py @@ -2159,6 +2159,9 @@ def helper(self): self.check(getattr(os, f)) return helper for f in singles: + # TODO: RUSTPYTHON: 'fstat' and 'fsync' currently fail on windows, so we've added the if + # statement here to wrap them. When completed remove the if clause and just leave a call to: + # locals()["test_"+f] = get_single(f) if f in ("fstat", "fsync"): locals()["test_"+f] = unittest.expectedFailureIfWindows("TODO: RUSTPYTHON fstat test (OSError: [Errno 18] There are no more files.")(get_single(f)) else: From 746dec898ed9211d534643fa75604d07d58f074d Mon Sep 17 00:00:00 2001 From: "Jeong, YunWon" <69878+youknowone@users.noreply.github.com> Date: Sun, 26 Mar 2023 21:59:33 +0900 Subject: [PATCH 79/80] Revert adding test_os to platform independent tests --- .github/workflows/ci.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index edbca3355d..9a2c66ee8b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -76,7 +76,6 @@ env: test_math test_operator test_ordered_dict - test_os test_pow test_raise test_richcmp From 0748b5da79913b751555f506350413714b4f836f Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 20 Apr 2023 13:48:01 +0900 Subject: [PATCH 80/80] revert skip test_os for windows --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9a2c66ee8b..f99806af62 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -292,6 +292,7 @@ jobs: test_glob test_importlib test_io + test_os test_pathlib test_posixpath test_shutil