Repository navigation
fix(tests): stub pymongo so the suite collects without a driver installed - #536
Merged
Merged
Conversation
…lled tests/test_name_maintenance.py imports fix_middle_names, which imports pymongo. CI installs pytest, jrc_common and doi_common only, so collection failed outright: ERROR collecting tests/test_name_maintenance.py ModuleNotFoundError: No module named 'pymongo' That took the whole suite down, not just the new file - a collection error is fatal, so the 94 pre-existing tests never ran either. Both interpreters have been failing since the maintenance programs landed. The stub carries a real exception class rather than a bare module. Both maintenance programs catch pymongo.errors.PyMongoError, and an except clause naming something that is not an exception class raises TypeError when it is reached - which would turn a database error into a confusing failure three frames from its cause. Nothing here exercises that path today, so the mistake would have sat unnoticed until it mattered. Verified in a virtual environment built to match the workflow exactly - pytest plus the two git-installed libraries, no pymongo, no tqdm, no jrc_email. 113 tests pass there, and the stub is confirmed to be the module actually in use. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
tests/test_name_maintenance.py imports fix_middle_names, which imports pymongo. CI installs pytest, jrc_common and doi_common only, so collection failed outright:
ERROR collecting tests/test_name_maintenance.py
ModuleNotFoundError: No module named 'pymongo'
That took the whole suite down, not just the new file - a collection error is fatal, so the 94 pre-existing tests never ran either. Both interpreters have been failing since the maintenance programs landed.
The stub carries a real exception class rather than a bare module. Both maintenance programs catch pymongo.errors.PyMongoError, and an except clause naming something that is not an exception class raises TypeError when it is reached - which would turn a database error into a confusing failure three frames from its cause. Nothing here exercises that path today, so the mistake would have sat unnoticed until it mattered.
Verified in a virtual environment built to match the workflow exactly - pytest plus the two git-installed libraries, no pymongo, no tqdm, no jrc_email. 113 tests pass there, and the stub is confirmed to be the module actually in use.