[AUTO-INF-5] Fix behave testing configuration #8326

Closed
opened 2026-04-13 08:54:01 +00:00 by HAL9000 · 1 comment
Owner

Summary

  • Document two configuration gaps in the Behave setup that prevent the suite from running reliably in infra tooling.
  • Propose targeted fixes in features/environment.py and behave.ini so the harness works regardless of launch directory and honours documented skip tags.

Findings

  1. features/environment.py only prepends /src to sys.path. When Behave is launched from a directory outside the repository (for example, cd /tmp && python -m behave /app/features/testing/tdd_expected_fail_demo.feature), Python raises ModuleNotFoundError: No module named 'features.mocks' because the repository root itself is missing from sys.path. Every step module imports helpers via features.mocks or features.fixtures, so the suite only starts if the current working directory happens to be /app. This blocks infra jobs that dispatch Behave from a scratch workspace.
  2. behave.ini currently comments out the default tag filter (# default_tags = not (@skip or @tdd_expected_fail)). With the filter disabled, plain behave runs execute scenarios tagged @skip or @tdd_expected_fail. The latter are intentional TDD captures that should stay filtered unless explicitly requested, and the former still reference unfinished behaviour. Leaving the filter disabled makes the CLI noisy and causes smoketests expecting those tags to be excluded to fail.

Proposed Fix

  • Insert the project root on sys.path in features/environment.py before adding src so helper packages resolve regardless of launch directory.
  • Restore the documented default_tags = not (@skip or @tdd_expected_fail) line in behave.ini so routine runs match the skip rules described in CONTRIBUTING.md.

Reproduction

  • Import failure: cd /tmp && python -m behave /app/features/testing/tdd_expected_fail_demo.feature ⇒ ModuleNotFoundError: No module named 'features.mocks'.
  • Tag drift: python -m behave features/testing/tdd_expected_fail_demo.feature currently executes the expected-fail scenario even though the config comment shows we intended to exclude it by default.

Duplicate Check

  • Queried the Forgejo API for existing issues mentioning this Behave configuration gap and found no prior reports.
  • No existing issue titled [AUTO-INF-5] Fix behave testing configuration is open.

Automated by CleverAgents Bot
Supervisor: Test Infrastructure Pool | Agent: test-infra-worker

## Summary - Document two configuration gaps in the Behave setup that prevent the suite from running reliably in infra tooling. - Propose targeted fixes in features/environment.py and behave.ini so the harness works regardless of launch directory and honours documented skip tags. ## Findings 1. features/environment.py only prepends <repo>/src to sys.path. When Behave is launched from a directory outside the repository (for example, cd /tmp && python -m behave /app/features/testing/tdd_expected_fail_demo.feature), Python raises ModuleNotFoundError: No module named 'features.mocks' because the repository root itself is missing from sys.path. Every step module imports helpers via features.mocks or features.fixtures, so the suite only starts if the current working directory happens to be /app. This blocks infra jobs that dispatch Behave from a scratch workspace. 2. behave.ini currently comments out the default tag filter (# default_tags = not (@skip or @tdd_expected_fail)). With the filter disabled, plain behave runs execute scenarios tagged @skip or @tdd_expected_fail. The latter are intentional TDD captures that should stay filtered unless explicitly requested, and the former still reference unfinished behaviour. Leaving the filter disabled makes the CLI noisy and causes smoketests expecting those tags to be excluded to fail. ### Proposed Fix - Insert the project root on sys.path in features/environment.py before adding src so helper packages resolve regardless of launch directory. - Restore the documented default_tags = not (@skip or @tdd_expected_fail) line in behave.ini so routine runs match the skip rules described in CONTRIBUTING.md. ### Reproduction - Import failure: cd /tmp && python -m behave /app/features/testing/tdd_expected_fail_demo.feature ⇒ ModuleNotFoundError: No module named 'features.mocks'. - Tag drift: python -m behave features/testing/tdd_expected_fail_demo.feature currently executes the expected-fail scenario even though the config comment shows we intended to exclude it by default. ### Duplicate Check - Queried the Forgejo API for existing issues mentioning this Behave configuration gap and found no prior reports. - No existing issue titled [AUTO-INF-5] Fix behave testing configuration is open. --- **Automated by CleverAgents Bot** Supervisor: Test Infrastructure Pool | Agent: test-infra-worker
Owner

superseded by next cycle

superseded by next cycle
HAL9000 added the
State
Verified
label 2026-04-13 17:26:14 +00:00
Sign in to join this conversation.
No Label
State
Verified
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: cleveragents/cleveragents-core#8326