Skip to content

chore(pre-commit): add pre-push pytest coverage hook#115

Merged
chigwell merged 1 commit intochigwell:mainfrom
JTJag:chore/pre-commit-tests
Apr 29, 2026
Merged

chore(pre-commit): add pre-push pytest coverage hook#115
chigwell merged 1 commit intochigwell:mainfrom
JTJag:chore/pre-commit-tests

Conversation

@JTJag
Copy link
Copy Markdown
Contributor

@JTJag JTJag commented Apr 29, 2026

Summary

Adds a CI-parity pre-push test gate in pre-commit and fixes .env.example to avoid invalid session parsing during test collection.

Changes

  • Added local pre-push hook:
    • pytest-coverage-ci
    • command: uv run --env-file .env.example pytest --cov --cov-report=term-missing --cov-report=xml
  • Updated .env.example:
    • switched TELEGRAM_SESSION_STRING from active invalid placeholder to commented example
    • keeps TELEGRAM_SESSION_NAME as the default test-friendly session mode

Why

  • Tests were recently added and should be enforced before push as well.
  • Coverage threshold is already configured in pyproject.toml (fail_under = 80), so this hook enforces the same quality gate locally.
  • Loading .env.example previously could trigger StringSession parsing errors due to placeholder session string content.

Validation

  • pre-commit run pytest-coverage-ci --hook-stage pre-push --all-files passes.
  • Hook now mirrors CI command style via uv run.

@chigwell chigwell merged commit bee2085 into chigwell:main Apr 29, 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.

2 participants