forked from cleveragents/cleveragents-core
d0689573e0
Add TDD regression tests for bug #570 where `_get_session_service()` calls `container.db()` but the DI `Container` class has no `db` provider, raising `AttributeError`. Same root cause as bug #554. Includes 4 Behave BDD scenarios tagged `@tdd_bug @tdd_bug_570 @tdd_expected_fail`, Robot Framework integration smoke tests with `--format plain`, and ASV service-layer benchmarks. Tests exercise the real DI path by resetting `_service = None` and using a file-based SQLite database. Implements the `@tdd_expected_fail` inversion infrastructure: - Behave: `after_scenario` hook in `features/environment.py` inverts pass/fail for scenarios tagged `@tdd_expected_fail` - Robot: `robot/tdd_expected_fail_listener.py` listener (API v3) performs the same inversion for Robot test cases - `noxfile.py`: registers the listener via `--listener` in both the `integration_tests` and `slow_integration_tests` sessions Migrates 18 existing TDD scenarios across 5 feature files from the old `@tdd @bugNNN` convention to the standardised `@tdd_bug @tdd_bug_NNN` tags per CONTRIBUTING.md § TDD Bug Test Tags. Refs: #570
55 lines
3.2 KiB
Plaintext
55 lines
3.2 KiB
Plaintext
*** Settings ***
|
|
Documentation Integration smoke test for session create DI error (bug #570).
|
|
... TDD-style tests — expected to FAIL until the DI container fix
|
|
... lands. The bug is that ``_get_session_service()`` calls
|
|
... ``container.db()`` but the DI container has no ``db`` provider,
|
|
... causing an ``AttributeError``. Same root cause as bug #554.
|
|
Resource ${CURDIR}/common.resource
|
|
Library Process
|
|
Library OperatingSystem
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Test Cases ***
|
|
Session Create After Init Should Not Error
|
|
[Documentation] After agents init, session create --format plain should
|
|
... exit 0 and produce a new session rather than a DI
|
|
... AttributeError.
|
|
[Tags] tdd_bug tdd_bug_570 tdd_expected_fail
|
|
${tmpdir}= Evaluate __import__('tempfile').mkdtemp(prefix='sce_570_')
|
|
${init}= Run Process ${PYTHON} -m cleveragents init sce-test
|
|
... timeout=60s cwd=${tmpdir}
|
|
Should Be Equal As Integers ${init.rc} 0
|
|
... msg=agents init should exit 0 but got ${init.rc}. stderr: ${init.stderr}
|
|
${create}= Run Process ${PYTHON} -m cleveragents session create --format plain
|
|
... timeout=60s cwd=${tmpdir}
|
|
Should Be Equal As Integers ${create.rc} 0
|
|
... msg=session create should exit 0 but got ${create.rc}. stderr: ${create.stderr}
|
|
Should Not Contain ${create.stderr} AttributeError
|
|
... msg=session create should not raise AttributeError: ${create.stderr}
|
|
[Teardown] Remove Directory ${tmpdir} recursive=True
|
|
|
|
Session Create Then List Shows Created Session
|
|
[Documentation] After creating a session, listing should show it.
|
|
[Tags] tdd_bug tdd_bug_570 tdd_expected_fail
|
|
${tmpdir}= Evaluate __import__('tempfile').mkdtemp(prefix='sce_570_list_')
|
|
${init}= Run Process ${PYTHON} -m cleveragents init sce-list
|
|
... timeout=60s cwd=${tmpdir}
|
|
Should Be Equal As Integers ${init.rc} 0
|
|
... msg=agents init should exit 0 but got ${init.rc}. stderr: ${init.stderr}
|
|
${create}= Run Process ${PYTHON} -m cleveragents session create --format plain
|
|
... timeout=60s cwd=${tmpdir}
|
|
Should Be Equal As Integers ${create.rc} 0
|
|
... msg=session create should exit 0 but got ${create.rc}. stderr: ${create.stderr}
|
|
Should Not Contain ${create.stderr} AttributeError
|
|
... msg=session create should not raise AttributeError: ${create.stderr}
|
|
${list}= Run Process ${PYTHON} -m cleveragents session list --format plain
|
|
... timeout=60s cwd=${tmpdir}
|
|
Should Be Equal As Integers ${list.rc} 0
|
|
... msg=session list should exit 0 but got ${list.rc}. stderr: ${list.stderr}
|
|
Should Contain ${list.stdout} total:
|
|
... msg=Expected 'total:' in plain output: ${list.stdout}
|
|
Should Not Contain ${list.stdout} total: 0
|
|
... msg=Expected at least one session in list output: ${list.stdout}
|
|
[Teardown] Remove Directory ${tmpdir} recursive=True
|