Problem
The staging integration-test job runs only deployed-service tests:
tests/integration/test_live_calculate.py
tests/integration/test_live_economy.py
But pytest still imports the top-level tests/conftest.py, and that file imports redis at module import time.
The workflow step currently installs only:
So test collection fails before any integration test runs with:
ImportError while loading conftest '/home/runner/work/policyengine-api/policyengine-api/tests/conftest.py'.
tests/conftest.py:6: in <module>
import redis
E ModuleNotFoundError: No module named 'redis'
Root cause
redis is only needed by the rest_client fixture, not by the deployed-service integration tests. But because it is imported eagerly at module import time, every test tier under tests/ inherits that dependency.
Fix
Import redis lazily inside the rest_client fixture so only tests that actually use that fixture require the package.
Problem
The staging integration-test job runs only deployed-service tests:
tests/integration/test_live_calculate.pytests/integration/test_live_economy.pyBut pytest still imports the top-level
tests/conftest.py, and that file importsredisat module import time.The workflow step currently installs only:
pytesthttpxSo test collection fails before any integration test runs with:
Root cause
redisis only needed by therest_clientfixture, not by the deployed-service integration tests. But because it is imported eagerly at module import time, every test tier undertests/inherits that dependency.Fix
Import
redislazily inside therest_clientfixture so only tests that actually use that fixture require the package.