Skip to content

Mark Windows-specific test failures as expected failures#7737

Open
samchakra0204 wants to merge 9 commits into
RustPython:mainfrom
samchakra0204:main
Open

Mark Windows-specific test failures as expected failures#7737
samchakra0204 wants to merge 9 commits into
RustPython:mainfrom
samchakra0204:main

Conversation

@samchakra0204
Copy link
Copy Markdown

@samchakra0204 samchakra0204 commented Apr 29, 2026

  • Added @unittest.expectedFailure + TODO: RUSTPYTHON to:
    • test_pathlib: surrogate/Windows-path tests
    • test_posixpath: invalid path tests (islink, ismount, realpath)
  • Other previously skipped tests (rlcompleter, venv) were already marked
  • No CI skip list existed in this fork, so no YAML change needed Closes Handle windows test proper way #3960

Summary by CodeRabbit

  • Chores
    • Updated CI workflow configuration for test matrix handling on Windows platform.

- Added @unittest.expectedFailure + TODO: RUSTPYTHON to:
  - test_pathlib: surrogate/Windows-path tests
  - test_posixpath: invalid path tests (islink, ismount, realpath)
- Other previously skipped tests (rlcompleter, venv) were already marked
- No CI skip list existed in this fork, so no YAML change needed
Closes RustPython#3960
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • Lib/test/test_venv.py is excluded by !Lib/**

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 8fa79d49-de08-483e-8a85-182949210e3c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The CI workflow's snippets_cpython job Windows matrix entry is modified to explicitly set extra_test_args as an empty list with a comment indicating -u all remains disabled on Windows. Inline test exclusion entries are removed from the configuration.

Changes

Windows Test Configuration

Layer / File(s) Summary
Windows Matrix Configuration
.github/workflows/ci.yaml
Windows matrix entry now explicitly sets extra_test_args to empty list with TODO comment. Skipped test exclusion entries (test_rlcompleter, test_pathlib, test_posixpath, test_venv) are removed from workflow configuration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested reviewers

  • fanninpm
  • youknowone

Poem

🐰 Windows tests now cleanly configured,
Extra args removed, exclusions migrated,
The CI workflow runs more straight,
Matrix entries aligned and light,
A tidier path forward in sight! 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change—adding @unittest.expectedFailure markers for Windows-specific test failures—which aligns with the PR's primary objective.
Linked Issues check ✅ Passed The PR addresses issue #3960 by removing CI skips and marking Windows-specific failures; changes to test_pathlib and test_posixpath align with linked issue requirements and commit progress.
Out of Scope Changes check ✅ Passed The CI YAML modification (removing Windows matrix entries and setting extra_test_args) directly supports the linked issue objective of removing CI skips for Windows tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 29, 2026

📦 Library Dependencies

The following Lib/ modules were modified. Here are their dependencies:

[x] lib: cpython/Lib/pathlib
[x] test: cpython/Lib/test/test_pathlib (TODO: 22)

dependencies:

  • pathlib

dependent tests: (91 tests)

  • pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_httpservers test_importlib test_launcher test_logging test_pathlib test_pkgutil test_runpy test_tarfile test_tempfile test_tomllib test_tools test_traceback test_unparse test_winapi test_zipapp test_zipfile test_zoneinfo test_zstd
    • compileall: test_compileall
    • importlib: test_bdb test_cmd_line_script test_codecs test_ctypes test_doctest test_frozen test_hashlib test_importlib test_inspect test_linecache test_modulefinder test_multiprocessing_main_handling test_py_compile test_pyclbr test_pydoc test_reprlib test_sundry test_support test_unittest test_zipfile test_zipimport test_zoneinfo
      • ctypes.util: test_ctypes
      • inspect: test_abc test_argparse test_asyncgen test_buffer test_builtin test_code test_collections test_coroutines test_decimal test_enum test_functools test_generators test_grammar test_monitoring test_ntpath test_operator test_patma test_posixpath test_signal test_sqlite3 test_type_annotations test_types test_typing test_unittest test_yield_from
      • py_compile: test_importlib
      • sysconfig: test_c_locale_coercion test_dtrace test_gc test_os test_osx_env test_posix test_pyexpat test_regrtest test_site test_ssl test_subprocess test_sys test_sysconfig test_time test_tools test_urllib2net
      • zipfile: test_shutil test_zipfile test_zipfile64
      • zipimport: test_importlib

[x] lib: cpython/Lib/posixpath.py
[x] test: cpython/Lib/test/test_posixpath.py (TODO: 6)

dependencies:

  • posixpath

dependent tests: (66 tests)

  • posixpath: test_pathlib test_posixpath test_zipfile
    • fnmatch: test_fnmatch test_os
      • bdb: test_bdb
      • glob: test_bz2 test_glob test_mailbox test_regrtest test_site test_tokenize test_unicode_file test_zipimport
      • shutil: test_argparse test_compileall test_ctypes test_filecmp test_httpservers test_importlib test_inspect test_largefile test_launcher test_logging test_modulefinder test_pkgutil test_py_compile test_reprlib test_sax test_shutil test_string_literals test_subprocess test_support test_sysconfig test_tarfile test_tempfile test_traceback test_zoneinfo
      • urllib.request: test_http_cookiejar test_pydoc test_ssl test_urllib test_urllib2 test_urllib2_localnet test_urllib2net test_urllibnet
    • http.server: test_robotparser test_xmlrpc
      • pydoc: test_enum
      • wsgiref.simple_server: test_wsgiref
      • xmlrpc.server: test_docxmlrpc
    • importlib.metadata: test_importlib
    • mimetypes: test_mimetypes
    • pathlib: test_ast test_dbm_sqlite3 test_ensurepip test_importlib test_pathlib test_runpy test_tomllib test_tools test_unparse test_winapi test_zipapp test_zipfile test_zstd

[ ] lib: cpython/Lib/venv
[ ] test: cpython/Lib/test/test_venv.py

dependencies:

  • venv (native: _winapi, sys)
    • logging (native: atexit, collections.abc, email.message, email.utils, errno, http.client, logging.handlers, multiprocessing.queues, select, sys, time, urllib.parse, win32evtlog, win32evtlogutil)
    • sysconfig (native: _sysconfig, _winapi, importlib.machinery, importlib.util, os.path, sys)
    • argparse, os, shlex, shutil, subprocess, types

dependent tests: (no tests depend on venv)

Legend:

  • [+] path exists in CPython
  • [x] up-to-date, [ ] outdated

Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tysm for the patch!

Can you pleas remove the relevant tests from:

skips:
- test_rlcompleter
- test_pathlib # panic by surrogate chars
- test_posixpath # OSError: (22, 'The filename, directory name, or volume label syntax is incorrect. (os error 123)')
- test_venv # couple of failing tests

So the CI will test them?

- Removed skips for test_rlcompleter, test_pathlib, test_posixpath, test_venv
- CI will now run these tests and show expected failures
- Addresses reviewer feedback
@samchakra0204
Copy link
Copy Markdown
Author

@ShaharNaveh Thanks for the catch! I’ve removed the skips: block for test_rlcompleter, test_pathlib, test_posixpath, and test_venv from .github/workflows/ci.yaml. The Windows CI will now run those modules, and the @unittest.expectedFailure markers should show them as expected failures instead of hiding them. Ready for another look when you have a moment.

@fanninpm
Copy link
Copy Markdown
Contributor

You may need to use RustPython's custom @unittest.expectedFailureIfWindows("TODO: RUSTPYTHON, ...") decorator if it fails only on windows.

Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm if CI passes

@fanninpm
Copy link
Copy Markdown
Contributor

if CI passes

About that...

Comment thread Lib/test/test_pathlib/test_pathlib.py Outdated
self.assertEqual(st, p.lstat())

# TODO: RUSTPYTHON
@unittest.expectedFailure
Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@unittest.expectedFailure
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")

The same for the rest of the patches, and then it should be good

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to update your comment because that decorator expects another argument.

# XXX: RUSTPYTHON
# This is very useful to reduce platform difference boilerplates in tests.
def expectedFailureIf(condition, reason):
assert reason.startswith("TODO: RUSTPYTHON")
if condition:
return expectedFailure
else:
return lambda x: x
# XXX: RUSTPYTHON
# Even more useful because most of them are windows only.
def expectedFailureIfWindows(reason):
import sys
return expectedFailureIf(sys.platform == 'win32', reason)

Comment thread Lib/test/test_venv.py
Comment thread .github/workflows/ci.yaml
- test_rlcompleter
- test_pathlib # panic by surrogate chars
- test_posixpath # OSError: (22, 'The filename, directory name, or volume label syntax is incorrect. (os error 123)')
- test_venv # couple of failing tests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samchakra0204 you can leave test_venv here, and fix it in a separate PR if you want to:)

Comment thread Lib/test/test_venv.py Outdated
else:
self.exe = 'python.exe'
else:
self.exe = os.path.split(executable)[-1]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this part @samchakra0204

@samchakra0204
Copy link
Copy Markdown
Author

@ShaharNaveh Hi, I’ve applied the requested revert in Lib/test/test_venv.py and pushed the latest update. Could you please take another look and verify the CI/CD pipeline test cases for this PR, especially the Windows test_venv / test_pathlib / test_posixpath coverage?

Copy link
Copy Markdown
Contributor

@ShaharNaveh ShaharNaveh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty:)

- Add @unittest.expectedFailureIfWindows decorators to venv tests that execute the venv python.exe
- Wrap subprocess calls in try/except to convert FileNotFoundError to AssertionError for expectedFailure to work
Comment thread Lib/test/test_venv.py Outdated
out, err = check_output(cmd, encoding='utf-8')
self.assertEqual(out.strip(), expected, err)
except Exception as e:
self.fail(f"venv executable failed: {e}")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to minimize our manual changes for upstream code.

If you want to can take the file from #7798 and apply your changes to it.

Comment thread .github/workflows/ci.yaml
- test_rlcompleter
- test_pathlib # panic by surrogate chars
- test_posixpath # OSError: (22, 'The filename, directory name, or volume label syntax is incorrect. (os error 123)')
- test_venv # couple of failing tests
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samchakra0204 If okay, can we have 4 different PRs for each removed skipped test (with the necessary test markers). this would allow us to iterate more rapidly, and get some of the code to be merged quicker (by not being blocked by another unrelated change)

@samchakra0204 samchakra0204 requested a review from ShaharNaveh May 9, 2026 12:07
- test_defaults_with_str_path, test_defaults_with_pathlike,
  test_upgrade, test_zippath_from_non_installed_posix
- Use @unittest.expectedFailureIfWindows with TODO: RUSTPYTHON comment
@youknowone youknowone enabled auto-merge (squash) May 9, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle windows test proper way

3 participants