Skip to content

Commit 79e3866

Browse files
authored
fix(tests): add __init__.py to test dirs to prevent module name conflicts
The CI was failing with a pytest collection error: ERROR collecting tests/unit_tests/tools/test_utils.py import file mismatch: imported module 'test_utils' has this __file__ attribute: tests/unit_tests/core/patches/test_utils.py HINT: remove __pycache__ / .pyc files and/or use a unique basename for your test file modules Root cause: two files named test_utils.py existed in different sub-directories of tests/unit_tests/ (core/patches/ and tools/), but their parent directories lacked __init__.py files. Without __init__.py, pytest imports every test file as a top-level module using just its basename, so both were imported as 'test_utils', causing the conflict. Fix: add empty __init__.py to all test sub-directories that were missing one, making each directory a proper Python package. pytest then imports tests with fully-qualified package paths (e.g. tests.unit_tests.core.patches.test_utils vs tests.unit_tests.tools.test_utils), eliminating the name collision.
1 parent c9c9235 commit 79e3866

12 files changed

File tree

tests/unit_tests/backends/__init__.py

Whitespace-only changes.

tests/unit_tests/backends/diffusion/__init__.py

Whitespace-only changes.

tests/unit_tests/backends/megatron/__init__.py

Whitespace-only changes.

tests/unit_tests/backends/torchtitan/__init__.py

Whitespace-only changes.

tests/unit_tests/cli/__init__.py

Whitespace-only changes.

tests/unit_tests/core/__init__.py

Whitespace-only changes.

tests/unit_tests/core/backend/__init__.py

Whitespace-only changes.

tests/unit_tests/core/launcher/__init__.py

Whitespace-only changes.

tests/unit_tests/core/patches/__init__.py

Whitespace-only changes.

tests/unit_tests/core/runtime/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)