fix: Makefile test targets for Debian system Python and sudo

- All test targets now use python3 -m pytest (not bare pytest)
- test-e2e-deps uses sudo pip3 --break-system-packages and
  sudo python3 -m playwright install (Debian externally-managed env)
- test-e2e-wg uses sudo -E python3 -m pytest (preserves PATH/env)
- reset-test-admin-pass uses make ifndef guard instead of shell ?: expansion
- Remove stale -m markers from test targets (filters were redundant)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-25 17:42:32 -04:00
parent a98e095e10
commit 828dc8cb8f
+13 -8
View File
@@ -234,11 +234,11 @@ test-coverage:
test-integration: test-integration:
@echo "Running full integration tests (requires running PIC stack)..." @echo "Running full integration tests (requires running PIC stack)..."
PIC_HOST=$${PIC_HOST:-localhost} pytest tests/integration/ -v PIC_HOST=$${PIC_HOST:-localhost} python3 -m pytest tests/integration/ -v
test-integration-readonly: test-integration-readonly:
@echo "Running read-only integration tests (no peer creation)..." @echo "Running read-only integration tests (no peer creation)..."
PIC_HOST=$${PIC_HOST:-localhost} pytest tests/integration/test_live_api.py tests/integration/test_webui.py -v PIC_HOST=$${PIC_HOST:-localhost} python3 -m pytest tests/integration/test_live_api.py tests/integration/test_webui.py -v
test-api: test-api:
cd api && python3 -m pytest tests/test_api_endpoints.py -v cd api && python3 -m pytest tests/test_api_endpoints.py -v
@@ -247,24 +247,29 @@ test-cli:
cd api && python3 -m pytest tests/test_cli_tool.py -v cd api && python3 -m pytest tests/test_cli_tool.py -v
# ── E2E tests ───────────────────────────────────────────────────────────────── # ── E2E tests ─────────────────────────────────────────────────────────────────
# Run `make test-e2e-deps` once to install dependencies, then use the other targets.
# WG tests require wg-quick and run under sudo (passwordless sudo assumed on this host).
test-e2e-deps: test-e2e-deps:
pip install -r tests/e2e/requirements.txt sudo pip3 install --break-system-packages -r tests/e2e/requirements.txt
playwright install --with-deps chromium sudo python3 -m playwright install --with-deps chromium
test-e2e-api: test-e2e-api:
@PIC_HOST=$${PIC_HOST:-localhost} pytest tests/e2e/api -v -m "not wg and not cell_link" @PIC_HOST=$${PIC_HOST:-localhost} python3 -m pytest tests/e2e/api -v
test-e2e-ui: test-e2e-ui:
@PIC_HOST=$${PIC_HOST:-localhost} pytest tests/e2e/ui -v -m ui @PIC_HOST=$${PIC_HOST:-localhost} python3 -m pytest tests/e2e/ui -v
test-e2e-wg: test-e2e-wg:
@PIC_HOST=$${PIC_HOST:-localhost} sudo -E env PATH=$$PATH pytest tests/e2e/wg -v -m wg -p no:xdist @PIC_HOST=$${PIC_HOST:-localhost} sudo -E python3 -m pytest tests/e2e/wg -v -p no:xdist
test-e2e: test-e2e-api test-e2e-ui test-e2e-wg test-e2e: test-e2e-api test-e2e-ui test-e2e-wg
reset-test-admin-pass: reset-test-admin-pass:
@python3 scripts/reset_admin_password.py "$${PIC_TEST_ADMIN_PASS:?Set PIC_TEST_ADMIN_PASS=<new-password>}" ifndef PIC_TEST_ADMIN_PASS
$(error Usage: make reset-test-admin-pass PIC_TEST_ADMIN_PASS=newpassword)
endif
python3 scripts/reset_admin_password.py "$(PIC_TEST_ADMIN_PASS)"
test-phase1: test-phase1:
cd api && python3 -m pytest tests/test_network_manager.py tests/test_phase1_endpoints.py -v cd api && python3 -m pytest tests/test_network_manager.py tests/test_phase1_endpoints.py -v