Affected Component
Other
Bug Description
test_admin_like_escape.py (lines 50-93) defines several generic DB-session test doubles _FakeScalarRows, _FakeResult, _FakeSession, _FakeSessionContext, and _install_fake_session_factory that aren't specific to this test file's subject matter. This kind of fake-session scaffolding is a common need for testing other admin endpoints too, so leaving it local to one file invites copy-paste duplication (and drift) as more admin endpoint tests are added.
Expected Behavior
Reusable test doubles like these should live in a shared test helper/fixture module (e.g. tests/_fakes.py or a conftest.py fixture) so other test files can import and reuse them instead of re-implementing the same fake session machinery.
Steps to Reproduce
- Open tests/test_admin_like_escape.py, lines 50-93
- Note _FakeScalarRows, _FakeResult, _FakeSession, _FakeSessionContext, and _install_fake_session_factory are generic (not specific to "like escape" behavior)
- Search tests/ for similar fake-session patterns in other admin-endpoint test files to confirm duplication
Code Sample
# current — tests/test_admin_like_escape.py
class _FakeScalarRows: ...
class _FakeResult: ...
class _FakeSession: ...
class _FakeSessionContext: ...
def _install_fake_session_factory(...): ...
# suggested fix — extract to a shared module, e.g. tests/_fakes.py
# tests/_fakes.py
class FakeScalarRows: ...
class FakeResult: ...
class FakeSession: ...
class FakeSessionContext: ...
def install_fake_session_factory(...): ...
# tests/test_admin_like_escape.py
from tests._fakes import install_fake_session_factory
Error Output / Logs
N/A — not a runtime error, this is test-code duplication/maintainability.
Environment
- OS: N/A (applies to all environments)
- Python version: N/A
- Node.js version: N/A
- Statewave version: main branch
- SDK version: N/A
- Deployment: N/A
Severity
Low - Minor issue, cosmetic, edge case
Additional Context
Good-first-issue candidate first step is to grep tests/ for other files reimplementing similar fake-session classes, then consolidate into one shared helper module and update imports. Filed under Bug Report template since no "refactor/test-quality" template exists in this repo.
Checklist
Affected Component
Other
Bug Description
test_admin_like_escape.py (lines 50-93) defines several generic DB-session test doubles _FakeScalarRows, _FakeResult, _FakeSession, _FakeSessionContext, and _install_fake_session_factory that aren't specific to this test file's subject matter. This kind of fake-session scaffolding is a common need for testing other admin endpoints too, so leaving it local to one file invites copy-paste duplication (and drift) as more admin endpoint tests are added.
Expected Behavior
Reusable test doubles like these should live in a shared test helper/fixture module (e.g. tests/_fakes.py or a conftest.py fixture) so other test files can import and reuse them instead of re-implementing the same fake session machinery.
Steps to Reproduce
Code Sample
Error Output / Logs
Environment
Severity
Low - Minor issue, cosmetic, edge case
Additional Context
Good-first-issue candidate first step is to grep tests/ for other files reimplementing similar fake-session classes, then consolidate into one shared helper module and update imports. Filed under Bug Report template since no "refactor/test-quality" template exists in this repo.
Checklist