Test coverage - #16
Closed
flangelo wants to merge 9 commits into
Closed
Conversation
Prevents the daemon from crashing when a corrupted/truncated message arrives during high-frequency flow pulse bursts.
python:3-alpine now resolves to 3.14, which newer pipenv rejects as an ambiguous match against `python_version = "3"` in --deploy mode.
pipenv 2024+ rejects python_version = "3" as an ambiguous match against 3.12.x in --deploy mode. Pin to <2024 to restore prior behavior.
Python 3.12 removed the `imp` module; the `future` package (and other kegbot deps) still depend on it, causing a crash at startup. Python 3.11 retains `imp` and is supported until 2027.
Thread.isAlive() was removed in Python 3.9; is_alive() is the replacement.
Stage 1 installs pipenv, exports requirements, builds a venv, and installs the package. Stage 2 copies only the venv and bin/ scripts, dropping pipenv, curl, and all build cache — 211 MB → 161 MB.
Surfaced while adding test coverage: - TokenRecord defined only __cmp__, which Python 3 ignores, so equality fell back to identity. AuthenticationManager._TokenRemoved therefore never matched the stored record and silently no-op'd, leaving captive auth flows running after token removal. Add __eq__ based on AsTuple(). - TapManager._RemoveTap referenced self.logger (not self._logger) and self._meters (which only exists on FlowManager) — two AttributeErrors. - Tap defined __eq__ without __hash__, making it unhashable under Python 3. Add __hash__ based on AsTuple().
Raise source coverage from ~58% to 85% (14 -> 77 tests): - New suites: backend, kegnet, kbevent, util, kb_threads, plus expanded manager and kegbot env tests. All I/O (Redis, Kegbot API, threads) is mocked, so the suite needs no external services. - Add a `test` stage to the Dockerfile (FROM builder AS test) mirroring kegbot-server: installs pytest/coverage, re-installs the package editable so coverage measures the source tree, and defaults to `coverage run -m pytest && coverage report --fail-under=80`. - Point CI (pybuild.yml) at `docker build --target test`, exercising the real image build. Drop the now-unneeded MySQL/Redis services since the suite mocks all I/O. - Remove the stale Travis config (Python 3.8); GitHub Actions is the active CI and the two diverging configs caused version drift. - Add pytest.ini and .coveragerc; ignore .coverage / .pytest_cache. - Document the recommended test workflow in CLAUDE.md.
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.
No description provided.