Commit 79e3866
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
- diffusion
- megatron
- torchtitan
- cli
- core
- backend
- launcher
- patches
- runtime
- trainer
- utils
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
0 commit comments