headroom/tests/test_cli
Garm 1788d907f0 fix(tests): scope sys.modules mutation and unpin hardcoded version
Three independent pre-existing test-hygiene regressions on main, all
surfaced as cascading CI failures:

1. tests/test_cli/test_wrap_copilot.py (from #229) mutated
   sys.modules["headroom.cli.main"] with a fake click.Group() at
   module-import time and never restored it. Any later test that did
   `from headroom.cli.main import main` got an empty group with no
   version option and no registered subcommands, breaking ~20
   test_cli/* and test_cli_proxy_env.py tests. Rewrite to import the
   real `main` directly — the fake-group indirection served no
   purpose.

2. tests/test_proxy_copilot_auth_hooks.py (from #229) installed fake
   httpx / fastapi.responses / headroom.proxy.* modules into
   sys.modules inside a helper called from test functions, never
   cleaned up. Later tests that imported ASGITransport or JSONResponse
   hit the fakes and failed with ImportError. Switch the helper to
   monkeypatch.setitem so the fakes are scoped to the owning test.

3. tests/test_release_version.py hardcoded canonical=0.5.25 in the
   subprocess-output assertion; the project version in pyproject.toml
   has since bumped to 0.9.1. Compute the expected value dynamically
   via get_canonical_version(ROOT) so the test tracks pyproject.
2026-04-22 12:37:22 +02:00
..
test_init_cli.py test: isolate windows init branches from os globals 2026-04-21 21:11:03 -05:00
test_install_cli.py test: expand persistent install coverage 2026-04-11 18:24:15 -05:00
test_main_help_version.py feat(cli): add Docker-native install flow and parity docs 2026-04-10 23:27:24 -05:00
test_mcp.py Enhanced MCP server with compress/stats tools, fix proxy torch crash 2026-03-16 22:56:30 -07:00
test_wrap_bridge.py feat(cli): support OpenClaw in Docker-native installs 2026-04-11 00:04:15 -05:00
test_wrap_copilot.py fix(tests): scope sys.modules mutation and unpin hardcoded version 2026-04-22 12:37:22 +02:00
test_wrap_openclaw.py feat(cli): support OpenClaw in Docker-native installs 2026-04-11 00:04:15 -05:00
test_wrap_persistent.py test: expand persistent install coverage 2026-04-11 18:24:15 -05:00