Commit bbe2fc3
fix: Resolve test collection import errors (ModuleNotFoundError)
Fixed import errors that occurred during full test suite collection:
- Error: "ModuleNotFoundError: 'empathy_os.workflows' is not a package"
- Tests passed individually but failed during full `pytest tests/` collection
Root Cause:
- Lazy loading mechanism in workflows/__init__.py using __getattr__
- Import order dependency: when tests imported workflows in different orders,
Python's import system became confused about package vs module
Solution:
1. Added import guard in tests/conftest.py to eagerly load workflows
- Calls discover_workflows() to trigger lazy loading of registered workflows
- Explicitly imports non-registered workflow modules used by tests
2. Deleted Mac Finder duplicate files (" 2.py" naming pattern)
Results:
- Test collection: 6,335 tests → 13,589 tests (+7,254 tests discovered)
- Import errors: 20+ errors → 0 errors
- All workflow tests now properly discovered and collectible
Files Modified:
- tests/conftest.py: Added workflow import guard with eager loading
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 895262b commit bbe2fc3
1 file changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
11 | 42 | | |
12 | 43 | | |
13 | 44 | | |
| |||
0 commit comments