Sorry, something went wrong.
|
I didn't change anything that should have affected this one failed test on Cygwin. I have a Windows VM now so I'll see if I can repro. |
Sorry, something went wrong.
|
The failed Cygwin test looks like a known flake with submodule ownership on Cygwin CI that I've been working on and hope to have a PR in for soon. To the best of my knowledge, that is independent of the changes here, though I emphasize that I have not reviewed this PR. I've triggered the test to rerun--my guess is that it will pass. |
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
|
Initially I was confused about strict as it's not actually used, but it's Ok and nothing one couldn't figure out and address next time someone gets confused by it. I debated a YAGNI approach, but I figured as a utility method, I should try to mirror the decorator as closely as I could. |
Sorry, something went wrong.
Summary
This PR introduces xfail_if_raises, a context manager that approximates @pytest.mark.xfail(..., raises=...) behavior inside a test body rather than as a decorator.
Problem
@pytest.mark.xfail evaluates its condition argument during test collection (module import time). In test_index_mutation, this condition includes Git().config("core.symlinks") == "true", which:
Solution
xfail_if_raises moves the xfail logic into the test body. The side-effectful condition is only evaluated if the test actually raises the specified exception(s). This keeps test collection lightweight and avoids relying on in-repo code as part of module import/test discovery.
This change is applied to test_index_mutation in test/test_index.py.
AI disclosure
This PR description was prepared with assistance from an agent. All code was written by hand.