Skip to content

Commit 606d819

Browse files
committed
Skip some importlib tests on windows + fix weird errors, hopefully?
1 parent 9105c44 commit 606d819

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

Lib/pathlib.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
)
4444

4545
def _ignore_error(exception):
46-
return (getattr(exception, 'errno', None) in _IGNORED_ERROS or
46+
# XXX RUSTPYTHON: added check for FileNotFoundError, file.exists() on windows throws it
47+
# but with a errno==ESRCH for some reason
48+
return (isinstance(exception, FileNotFoundError) or
49+
getattr(exception, 'errno', None) in _IGNORED_ERROS or
4750
getattr(exception, 'winerror', None) in _IGNORED_WINERRORS)
4851

4952

Lib/test/support/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,12 +1066,15 @@ def temp_dir(path=None, quiet=False):
10661066
try:
10671067
rmtree(path)
10681068
except OSError as exc:
1069-
# XXX RUSTPYTHON: added quiet check here, not sure why rmtree fails on windows
1070-
if not quiet:
1071-
raise
1072-
warnings.warn(f'unable to remove temporary'
1073-
f'directory {path!r}: {exc}',
1074-
RuntimeWarning, stacklevel=3)
1069+
# XXX RUSTPYTHON: something something async file removal?
1070+
# also part of the thing with rmtree()
1071+
# throwing PermissionError, I think
1072+
if os.path.exists(path):
1073+
if not quiet:
1074+
raise
1075+
warnings.warn(f'unable to remove temporary'
1076+
f'directory {path!r}: {exc}',
1077+
RuntimeWarning, stacklevel=3)
10751078

10761079
@contextlib.contextmanager
10771080
def change_cwd(path, quiet=False):

Lib/test/test_importlib/test_windows.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def test_module_not_found(self):
8888

8989
@unittest.skipUnless(sys.platform.startswith('win'), 'requires Windows')
9090
class WindowsExtensionSuffixTests:
91+
# TODO: RUSTPYTHON
92+
@unittest.expectedFailure
9193
def test_tagged_suffix(self):
9294
suffixes = self.machinery.EXTENSION_SUFFIXES
9395
expected_tag = ".cp{0.major}{0.minor}-{1}.pyd".format(sys.version_info,

0 commit comments

Comments
 (0)