Skip to content

Add unit test suite and GitHub Actions CI - #2

Merged
AliZakaee merged 1 commit into
mainfrom
test/add-pytest-suite-and-ci
Jun 2, 2026
Merged

AliZakaee merged 1 commit into
mainfrom
test/add-pytest-suite-and-ci

Conversation

@AliZakaee

Copy link
Copy Markdown
Owner

Add a comprehensive pytest suite (262 tests) covering pure logic, the SQLite data layer, the service layer, and the Telegram handler pipeline:

  • Tooling: pyproject.toml (pytest + coverage config), requirements-dev.txt, and a root conftest.py with shared fixtures (temp DB, fake Config, clean env, duck-typed Message/CallbackQuery, stub bot, fernet key).
  • Pure logic: utils (escaping, splitting, sensitive detection, masking, time), config validators, keyboards callback-data limits, embeddings (cosine/keyword/matrix), KB chunking/context.
  • Data layer: settings coercion round-trips and full DAL incl. approval double-tap atomicity, FK cascade, owner-pending TTL — against a real temp DB.
  • Services: OpenAI (Fernet protect/unprotect, _map_error, max_tokens retry), Codex (prompt build, flag fallback, subprocess mocked), prompt assembly, rate-limit windows, KB retrieval, memory ordering/trim, business pause expiry, file sanitization. No network or subprocess is ever touched.
  • Handlers: process_business_message branch-by-branch, approval card/edit flow, telegram_api send adapter + fallback, notify_owner.

CI: .github/workflows/tests.yml runs the suite on a Python 3.10/3.11/3.12 matrix for every push and PR to main, with coverage measured and uploaded as an artifact (report-only) and an aggregate "tests" check for branch protection. README documents local runs and the merge-protection setup.

Add a comprehensive pytest suite (262 tests) covering pure logic, the
SQLite data layer, the service layer, and the Telegram handler pipeline:

- Tooling: pyproject.toml (pytest + coverage config), requirements-dev.txt,
  and a root conftest.py with shared fixtures (temp DB, fake Config, clean
  env, duck-typed Message/CallbackQuery, stub bot, fernet key).
- Pure logic: utils (escaping, splitting, sensitive detection, masking,
  time), config validators, keyboards callback-data limits, embeddings
  (cosine/keyword/matrix), KB chunking/context.
- Data layer: settings coercion round-trips and full DAL incl. approval
  double-tap atomicity, FK cascade, owner-pending TTL — against a real temp DB.
- Services: OpenAI (Fernet protect/unprotect, _map_error, max_tokens retry),
  Codex (prompt build, flag fallback, subprocess mocked), prompt assembly,
  rate-limit windows, KB retrieval, memory ordering/trim, business pause
  expiry, file sanitization. No network or subprocess is ever touched.
- Handlers: process_business_message branch-by-branch, approval card/edit
  flow, telegram_api send adapter + fallback, notify_owner.

CI: .github/workflows/tests.yml runs the suite on a Python 3.10/3.11/3.12
matrix for every push and PR to main, with coverage measured and uploaded
as an artifact (report-only) and an aggregate "tests" check for branch
protection. README documents local runs and the merge-protection setup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AliZakaee AliZakaee self-assigned this Jun 2, 2026
@AliZakaee
AliZakaee merged commit 06db2e9 into main Jun 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant