Testing¶
The offline test suite covers everything in github_monitor.py that can run without network access. GitHub API objects are replaced with test doubles, so the suite needs no GitHub account, no network and no credentials.
Running the suite¶
From the repository root:
pyproject.toml puts the repository root first on sys.path, so the tests exercise the working tree rather than an installed copy.
Run the linter the same way CI does:
Build this documentation the way CI does, which fails on a broken link or a missing page:
CI runs all three on every push and pull request, across Python 3.10 through 3.14, and again before anything is published to PyPI.
What is covered¶
The test layout mirrors the surfaces a user touches rather than the module layout. See tests/README.md for the file-by-file map.
Conventions¶
- Keep every test offline. If a code path needs network access, stub it with
monkeypatchrather than skipping the test. - Restore module-level globals you change. Tests share one imported module, so a leaked global affects whatever runs next.
- Exported secrets are cleared before every test, because loading a dotenv writes them into
os.environand nothing removes them again. Set the one a test needs withmonkeypatch.setenvinside that test. - Never use a real GitHub personal access token, SMTP password or webhook URL.
A change to the monitoring loop, authentication or GitHub data handling is not verified by this suite alone. Exercise it against a real account and say so in the pull request, without usernames or credentials.