Repository navigation
fix: keep test doubles out of the shipped package; cover ftps and netsafety edge paths - #157
Merged
Merged
Conversation
…uality numbers patched_logger imported unittest.mock inside bambu_cli; it moves into the one test that used it. namespace_get and _host_of keep their defensive behaviour with docstrings that describe the real inputs. The CI grep now rejects unittest, pytest and mock imports in bambu_cli/, and tests/test_production_purity.py checks the same on the AST. Roadmap, backlog and README coverage and test counts re-measured.
DLANSAMA
marked this pull request as ready for review
November 7, 2026 16:25
Default-argument handling in ImplicitFTPS.connect, cleanup when a socket or file will not close, the unprotected data channel, the redirect handler's header rules, the HTTPS handler's optional context and the throttle table's size cap. Both modules reach 100% branch coverage. Roadmap, backlog and README numbers re-measured: 2239 tests, 93.8%.
…ge numbers for the combined tree
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.
What and why
Plan box B-6 (v1.0.0 ship checklist). Two commits, both from the checklist audit.
1. Test doubles out of the shipped package, stale numbers refreshed
logging_utils.patched_loggerimportedunittest.mockinsidebambu_cli. It had one caller, a test, so it moves there.set_logger/reset_loggerstay.argutils.namespace_getandnetsafety._host_ofkeep their behaviour (never raise on odd input). Their docstrings now describe the real inputs instead of citing a MagicMock.import/fromofunittest,pytestandmockinbambu_cli/. It matches the old tree and is clean on this one.tests/test_production_purity.pychecks the same on the AST (imports, Mock class names,sys.modulesprobes), so the rule is a test and not only a sentence.2.
ftps.pyandnetsafety.pyreach 100% branch coverageBoth were under the roadmap's own per-module bar (88.9% and 93.2%; A is 90 and 95). New
tests/test_transport_edges.py(13 tests, no sockets) covers:ImplicitFTPS.connectdefault-argument handling, and cleanup when the socket or file will not close (the handshake error still reaches the caller).Docs
Roadmap, test backlog and README cite the re-measured numbers: 2239 tests, 93.8% over 9436 statements (local Linux, 2026-11-07). The roadmap's "coverage 91.0→92 remains" line is replaced with what actually remains.
Checklist
uvx ruff check bambu_cliuvx ruff format --check bambu_cliuvx mypy -p bambu_cliuvx bandit -c pyproject.toml -r bambu_cli -lluv run python -m pytest tests/ -q -m "not live": 2239 passed, 1 skipped, 1 live deselected, with-W error::ResourceWarninguv run python tests/python_compat_smoke.pyAlso run: layers, schemas, syntax, ci_workflow, privacy and release_readiness smokes, and the docs-consistency tests. The full CI matrix (Linux 3.10/3.12/3.14, Windows, macOS) was green on the first commit; it re-runs for the second.
Public API note:
bambu_cli.logging_utils.patched_loggeris removed (listed in the changelog).