fix(test): remove eager tdd_test_helpers import from mocks __init__ #985

Merged
brent.edwards merged 1 commit from fix/benchmark-tdd-import into master 2026-03-16 23:29:51 +00:00
Member

Summary

Fixes the ASV benchmark regression introduced by PR #673's merge. The features/mocks/__init__.py eagerly imported make_mock_scenario from tdd_test_helpers, which transitively imports behave.model.Status. The ASV benchmark environment does not have behave installed, causing ModuleNotFoundError during benchmark discovery.

Root Cause

The import chain: benchmarks/actor_list_empty_bench.pyfrom mocks.fake_provider import ...features/mocks/__init__.pyfrom .tdd_test_helpers import make_mock_scenariofrom behave.model import StatusModuleNotFoundError: No module named 'behave'

Fix

Removed the eager re-export of make_mock_scenario from features/mocks/__init__.py. All callers already import via the full module path (from features.mocks.tdd_test_helpers import make_mock_scenario), so the re-export was unnecessary. Added a comment documenting why this module is excluded from the package-level re-exports.

Quality Gates

Gate Result
Pre-commit hooks All PASS
Lint PASS
Typecheck PASS

Closes #628

## Summary Fixes the ASV benchmark regression introduced by PR #673's merge. The `features/mocks/__init__.py` eagerly imported `make_mock_scenario` from `tdd_test_helpers`, which transitively imports `behave.model.Status`. The ASV benchmark environment does not have `behave` installed, causing `ModuleNotFoundError` during benchmark discovery. ### Root Cause The import chain: `benchmarks/actor_list_empty_bench.py` → `from mocks.fake_provider import ...` → `features/mocks/__init__.py` → `from .tdd_test_helpers import make_mock_scenario` → `from behave.model import Status` → **`ModuleNotFoundError: No module named 'behave'`** ### Fix Removed the eager re-export of `make_mock_scenario` from `features/mocks/__init__.py`. All callers already import via the full module path (`from features.mocks.tdd_test_helpers import make_mock_scenario`), so the re-export was unnecessary. Added a comment documenting why this module is excluded from the package-level re-exports. ### Quality Gates | Gate | Result | |------|--------| | Pre-commit hooks | All PASS | | Lint | PASS | | Typecheck | PASS | Closes #628
fix(test): remove eager tdd_test_helpers import from mocks __init__
All checks were successful
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 17s
CI / build (pull_request) Successful in 27s
CI / quality (pull_request) Successful in 29s
CI / security (pull_request) Successful in 42s
CI / typecheck (pull_request) Successful in 42s
CI / e2e_tests (pull_request) Successful in 1m32s
CI / unit_tests (pull_request) Successful in 3m9s
CI / docker (pull_request) Successful in 9s
CI / integration_tests (pull_request) Successful in 3m34s
CI / coverage (pull_request) Successful in 5m54s
CI / benchmark-regression (pull_request) Successful in 37m11s
288246d9b5
The re-export of make_mock_scenario from features/mocks/__init__.py
caused ASV benchmark discovery to fail because tdd_test_helpers imports
behave.model.Status, which is unavailable in the ASV benchmark
virtualenv.  All callers already import via the full module path
(features.mocks.tdd_test_helpers), so the re-export was unnecessary.

ISSUES CLOSED: #628
brent.edwards scheduled this pull request to auto merge when all checks succeed 2026-03-16 23:29:07 +00:00
brent.edwards deleted branch fix/benchmark-tdd-import 2026-03-16 23:29:52 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!985
No description provided.