test: rename oold.py to oold_test.py so its tests are collected - #147
Merged
Conversation
- the filename matched neither test_*.py nor *_test.py, so its 6 tests had never been collected by pytest - the basename also shadowed the installed oold package on sys.path, breaking `pytest tests/utils/` with "No module named 'oold.utils'" - full default suite goes from 36 to 42 passed
Contributor
Release previewNo version bump from the current commits (stays at Changelog preview (truncated)Preview via python-semantic-release and conventional commits. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Renames
tests/utils/oold.pytotests/utils/oold_test.py. One-line change, two effects.The mishap
The file holds 6 real tests for
osw.utils.oold, but was named after the module under test rather than after pytest's collection pattern. It matches neithertest_*.pynor*_test.py, and the repo overrides nopython_files, so pytest never collected it. Its 4 siblings in the same directory all use*_test.py.The same name caused a second, louder problem. Neither
tests/nortests/utils/has an__init__.py, so pytest's defaultprependimport mode insertstests/utils/atsys.path[0]. A bareimport ooldthen resolves to this file, a plain module with no__path__, instead of the installedooldpackage:Full-suite runs happened to survive this only by collection-order luck: a top-level
tests/*.pyfile importsosw.*first, which caches the realooldinsys.modules, and the cache then short-circuits the poisoned path. Narrower runs got no such luck. Onmain:The fix
Rename to
oold_test.py. The basename no longer collides with the installed package, which removes thesys.pathshadow, and the file now matches the collection pattern, which enables its tests.Result
test_deep_equal,test_unique_array,test_deep_merge,test_merge_jsonld_context_object_list,test_aggregate_generated_schemas,test_escape_json_stringspytest tests/utils/works for the first time: 29 passed, 1 skipped (was 3 collection errors)Contents are unchanged; the diff is a pure rename (100% similarity).