# ImportError: cannot import name 'helpers' from partially initialized module 'tests' (most likely due to a circular import)

- **ID:** `python/pytest-conftest-import-shadowing`
- **Domain:** python
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Two conftest.py files in nested test directories import the same helper module that itself imports from the test package, creating a cycle during pytest collection.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## Workarounds

1. **** (90% success)
   ```
   # Layout:
# tests/conftest.py
# tests/helpers.py  <-- imports tests.something (cycle)
# Fix: move helpers to project root
# helpers.py
import sys, pathlib
sys.path.insert(0, str(pathlib.Path(__file__).parent))
import helpers
   ```
2. **** (88% success)
   ```
   # tests/conftest.py
@pytest.fixture
def client():
    from tests.helpers import make_client  # imported at call time
    return make_client()
   ```

## Dead Ends

- **** — Making tests a package can change rootdir behavior and does not break the import cycle between helpers and conftest. (70% fail)
- **** — Deferred import still triggers the cycle if helpers imports from tests at module load time. (80% fail)
