Add tests - #8
Open
marcogobbo wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add test suite, CI, and main-branch protection
Hardens the project so new features reach
mainonly through a reviewed, CI-passing PR. Adds an automated test suite, a GitHub Actions pipeline, and local pre-commit enforcement.Tests
Adds a pytest suite (66 tests) covering the pure logic plus light, mocked cog tests:
test_uta_parser.py— UTA CGI HTML parser: timestamp parsing + fallback, analog grabs, therirpresatypo tolerance, season→setpoint routing, alarm/state phrase inference, chiller alarm discrimination, and UtaSnapshot property truth tables.test_proteox_snapshot.py—Snapshot.status/is_idle/temperature_valueandSensorReading.formatted(heaterOFF,N/A,Out of range).test_fridge_config.py— loads the real config/*.yaml, validatespt2_key, and rejects unknown quantities.test_settings.py— env-driven loading: full fridge, incomplete-fridge skip, zero-fridges error, invalid destination type.test_cogs.py— mockedReportsCogrouting/ephemeral-defer andSchedulerCogskip-vs-post decisions (idle+warm, running, idle+cold, LOCAL mode).conftest.pyprovides shared UTA HTML fixtures;test_units.pyextended with magnetic-field, negative, and sub-prefix cases.Tooling
[tool.black]and a pragmatic[tool.mypy]baseline..pre-commit-config.yamlruns trailing-whitespace/EOF/yaml checks, black, ruff, and mypy (mypy hook given the project's typed deps so it matchespoetry run mypy).CI (
.github/workflows/ci.yml)Runs on PRs to
main:lint— pre-commit (ruff + black + mypy + basic hooks).test (3.11) / test (3.12)— pytest across both Python versions.Incidental fixes surfaced by the new checks
500 Parenders as500.0 Pa, not0.5 kPa).timezoneimport inmonday.py.# type: ignorecomments and added a missingassertinproteox.pyfor aFollow-up (manual, post-merge)
Enable branch protection on
main: require a PR, 1 approval, dismiss stale approvals,lint, test (3.11), test (3.12). (Requires the workflow to have run once so the check namesregister.)
Verification
pytest(66 passed),ruff,black --check,mypy src, andpre-commit run --all-filesall