-
Notifications
You must be signed in to change notification settings - Fork 19
Fix/address flaky tests #289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
seddonym
merged 4 commits into
python-grimp:main
from
nathanjmcdougall:fix/address-flaky-tests
Dec 20, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0d312d3
Use more robust path handling in `test_syntax_error_includes_module` …
nathanjmcdougall 89e1039
Use context manager for settings in `configure_unit_tests` fixture
nathanjmcdougall 36c2f39
Merge remote-tracking branch 'upstream/main' into fix/address-flaky-t…
nathanjmcdougall 94e4421
Add `match` arg in `pytest.warns` for `DeprecationWarning` of `Names…
nathanjmcdougall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,15 @@ | ||
| import pytest # type: ignore | ||
|
|
||
| from grimp.application.config import settings | ||
| from grimp.application.graph import ImportGraph | ||
| from grimp.adaptors.modulefinder import ModuleFinder | ||
| from tests.config import override_settings | ||
|
|
||
|
|
||
| @pytest.fixture(scope="module", autouse=True) | ||
| def configure_unit_tests(): | ||
| settings.configure( | ||
| with override_settings( | ||
nathanjmcdougall marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| IMPORT_GRAPH_CLASS=ImportGraph, | ||
| MODULE_FINDER=ModuleFinder(), | ||
| FILE_SYSTEM=None, | ||
| ) | ||
| ): | ||
| yield | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of interest, why does this change fix the issue? They look equivalent to me.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are differences in behaviour between
os.path.abspathandpathlib.resolve(). Specifically (in this case) the latter will normalize Windows drive letter names to capitalize them, e.g.c:\->C:\. There are differences with unix too:abspathwill only make the path absolute, e.g. it won't apply resolutions (e.g. symlinks etc.).It looks like
build_graphalready applies this normalization, so to get the test to match, we need to match the exact string including capitalization.Without the fix:
Versus with the fix
When running pytest from the CLI/Just, the VS Code console uses capital
C:\for the current directory (so tests pass) but when running from the VS Code test-running UI, by default the--root-dirargument is set using a non-normalized path with lower-casec:\, and the test was failing.