# ImportError: cannot import name 'test_helper' from 'tests' (unknown location)

- **ID:** `python/pytest-collection-module-error`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

pytest 在收集测试时无法正确导入测试模块，通常由于缺少 __init__.py 或路径配置错误。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.4.0 | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   在 tests 目录下创建 __init__.py，并确保模块路径正确。
   ```
2. **** (85% success)
   ```
   在 pyproject.toml 或 pytest.ini 中设置 `pythonpath = .` 确保项目根目录在路径中。
   ```

## Dead Ends

- **** — 可能掩盖包结构问题，且 pytest 的导入机制不同。 (50% fail)
- **** — 如果使用 pytest 的 rootdir 机制，可能需要保留。 (60% fail)
