Skip to content

Commit 459097d

Browse files
authored
Merge pull request #3518 from PolicyEngine/fix/lazy-redis-import
Import redis lazily for deployed-service integration tests; taking liberty of merging before tests run because: 1. This affects something that will only be testable in integ tests 2. This literally only changes conftest
2 parents 3b163e3 + 3a1ddf8 commit 459097d

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed staging integration test collection by importing `redis` lazily inside the `rest_client` fixture instead of at `tests/conftest.py` module import time.

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from contextlib import contextmanager
44
from subprocess import Popen, TimeoutExpired
55
import sys
6-
import redis
76
import pytest
87

98
# Add the project root directory to PYTHONPATH
@@ -31,6 +30,7 @@ def running(process_arguments, seconds_to_wait_after_launch=0):
3130
def client():
3231
"""run the app for the tests to run against"""
3332
from policyengine_api.api import app
33+
import redis
3434

3535
app.config["TESTING"] = True
3636
with running(["redis-server"], 3):

0 commit comments

Comments
 (0)