Conversation
ideaship
left a comment
There was a problem hiding this comment.
Review
Foundation is structurally sound: directory layout is correct, conftest.py handles the dynaconf import-time constraint cleanly, CI wiring is in place, and pipenv run pytest passes. Two items need to be fixed before merge.
Correctness bugs
1. Stale Pipfile.lock
pipenv verify reports the lock is out of date. The committed _meta.hash.sha256 does not match the current Pipfile. The Zuul job runs pipenv install --dev (without --deploy), which silently re-resolves and relocks rather than failing — so CI will drift away from the committed lock whenever a dependency has a newer release. Fix: run pipenv lock and commit the result, or add --deploy to the CI command to hard-fail on stale locks.
2. pytest==9.0.3 requires Python >=3.10; project declares requires-python = ">=3.8"
pytest==9.0.3 has Requires-Python: >=3.10. Modern pip resolves this at download time and will reject the install on Python 3.8/3.9, so the README instructions (pip install -r requirements.txt -r test-requirements.txt) are broken for those versions. The Zuul job also does not pin a Python version — issue #233 explicitly listed this as in-scope and recommended 3.13.
Fix: either pin Python >=3.10 (or 3.13 per the issue) in .zuul.yaml and document that the test suite requires Python 3.10+, or drop to a pytest version that supports 3.8+. The former is the cleaner path.
Missing / weak tests
3. get_leading_number has no behavioral test
test_main_module_imports only calls callable(main.get_leading_number). The function is pure and used in production paths (lines 975, 977 of main.py). A one-liner like assert main.get_leading_number("100-foo.yml") == "100" would provide an actual correctness check at zero extra cost.
4. test_main_module_imports — callable(main.deep_merge) is redundant
test_deep_merge_smoke already calls deep_merge directly; if it were missing or broken, that test would fail. The callable() check adds nothing.
5. test_dtl_module_imports checks class existence, not behavior
hasattr(dtl, "Repo") / hasattr(dtl, "NetBox") / hasattr(dtl, "DeviceTypes") verify that three class names are present in the module namespace. No method on any of them is called. Acceptable for a pure smoke test, but worth noting as coverage expands under #232.
Minor
pyproject.tomlexcludestests/from mypy entirely. Issue #233 (open question 4) recommended including it withdisable_error_code = ["no-untyped-def"]. Either choice is defensible; worth an explicit decision in the PR description.
a179f6e to
cf2290d
Compare
Sets up the test infrastructure so per-module unit tests for netbox_manager/ can be added incrementally (foundation work for #232, implements #233): pytest config in pyproject.toml, tests/ tree at repo root with a dynaconf settings stub in conftest.py and smoke tests for deep_merge and get_leading_number, new netbox-manager-unit-tests Zuul job in check / periodic-daily, and dev deps mirrored in Pipfile + test-requirements.txt. The Zuul job runs pipenv install --deploy --dev so stale Pipfile.lock entries fail loudly instead of silently re-resolving. The pre-run playbook mirrors osism/python-osism: it uses the system Python from the build node (Debian Bookworm's 3.11) and only installs pipenv via apt, instead of pulling Python 3.13 from the deadsnakes PPA. This removes a flaky external dependency on Launchpad — an earlier run timed out fetching PPA metadata and failed the whole job before tests could start. Closes #233 AI-assisted: Claude Code Signed-off-by: Christian Berendt <berendt@osism.tech>
Sets up the test infrastructure so per-module unit tests for netbox_manager/ can be added incrementally (foundation work for #232, implements #233): pytest config in pyproject.toml, tests/ tree at repo root with a dynaconf settings stub in conftest.py and a smoke test, new netbox-manager-unit-tests Zuul job in check / periodic-daily, and dev deps mirrored in Pipfile + test-requirements.txt. Also extends .gitignore to exclude pycache/, *.egg-info/, and .pytest_cache/.
Closes #233
AI-assisted: Claude Code