Description
The test suite fails to properly detect missing or malformed module initialization files. When is_one_one/__init__.py is missing or empty, the test file imports fail, but the error is caught by an overly broad exception handler, resulting in cryptic test failures instead of clear import errors.
This makes debugging difficult for new contributors who fork the repo and run tests.
Steps to Reproduce
- Clone the repository
- Remove or rename
is_one_one/__init__.py
- Run pytest:
pytest test_main.py
- Observe the error message
Expected: Clear ImportError or ModuleNotFoundError stating that is_one_one module cannot be found
Actual: Cryptic error message like 'unexpected keyword argument' or 'NoneType has no attribute...'
Environment Information
- Python: 3.8+
- pytest: 7.x+
- OS: macOS / Linux / Windows
Expected Behavior
The test should fail immediately with a clear message: 'ModuleNotFoundError: No module named is_one_one' or similar
Actual Behavior
The test fails with an unhelpful error message because the import exception is caught and suppressed
Additional Context
Root cause: The test file likely has a bare except: clause or except Exception: that catches the import error along with other exceptions.
Proposed fix: Replace broad exception handlers with specific ones:
# BAD
try:
from is_one_one import *
except: # catches everything including import errors
pass
# GOOD
try:
from is_one_one import *
except (ImportError, ModuleNotFoundError) as e:
raise ImportError(f"Failed to import is_one_one: {e}") from e
Severity: Low - affects development workflow, not production code.
Expected GSSoC points: Level 1 (beginner test infrastructure fix)
Suggested Labels
bug, level:beginner, gssoc, testing
Checklist
Description
The test suite fails to properly detect missing or malformed module initialization files. When
is_one_one/__init__.pyis missing or empty, the test file imports fail, but the error is caught by an overly broad exception handler, resulting in cryptic test failures instead of clear import errors.This makes debugging difficult for new contributors who fork the repo and run tests.
Steps to Reproduce
is_one_one/__init__.pypytest test_main.pyExpected: Clear ImportError or ModuleNotFoundError stating that is_one_one module cannot be found
Actual: Cryptic error message like 'unexpected keyword argument' or 'NoneType has no attribute...'
Environment Information
Expected Behavior
The test should fail immediately with a clear message: 'ModuleNotFoundError: No module named is_one_one' or similar
Actual Behavior
The test fails with an unhelpful error message because the import exception is caught and suppressed
Additional Context
Root cause: The test file likely has a bare
except:clause orexcept Exception:that catches the import error along with other exceptions.Proposed fix: Replace broad exception handlers with specific ones:
Severity: Low - affects development workflow, not production code.
Expected GSSoC points: Level 1 (beginner test infrastructure fix)
Suggested Labels
bug,level:beginner,gssoc,testingChecklist