Files
cleveragents-core/scripts
brent.edwards 6da625d509 perf(tests): reduce per-feature startup cost with shared fixtures and lazy imports
Replace per-scenario Alembic migration runs (~0.5-3s × 25 migrations)
with a pre-migrated template SQLite database copied in ~1ms:

- New scripts/create_template_db.py creates a fully-migrated SQLite file
  using Base.metadata.create_all() + alembic stamp (34 tables, ~5ms).
- noxfile.py unit_tests and coverage_report sessions generate the
  template before test execution, propagating CLEVERAGENTS_TEMPLATE_DB
  env var to all behave-parallel workers.
- features/environment.py before_all() installs a monkey-patch on
  MigrationRunner.init_or_upgrade that copies the template for fresh
  scenario temp DBs (cleveragents_* / cleveragents_test_* prefix),
  falling through to real migrations for :memory:, existing files,
  non-SQLite, and custom URLs used by migration-runner unit tests.

Quick wins:
- cli_streaming_steps.py: sleep(0.5) → sleep(0.05) in wait-for-completion
- cli_streaming.feature: remove redundant Background re-declaration in
  scenario 7 (already inherited from Feature-level Background)

Part of #478. Closes #483.
2026-03-01 03:39:30 +00:00
..