Closed ciaransweet closed 2 years ago
Actually, it now appears that it only works if I pass the full path to the directory where the test is located.
My conftest.py
looks like:
import os
import requests
from logzero import logger
from pytest import fixture
def check_slow_service() -> bool:
try:
resp = requests.get("http://localhost:8700")
resp.raise_for_status()
logger.debug("test_exit.py's slow_service is ready!")
return True
except Exception:
logger.debug("test_exit.py's slow_service not yet ready, trying again.")
return False
@fixture(scope="session")
def docker_compose_file(pytestconfig) -> str:
return os.path.join(
pytestconfig.rootdir, "tests", "test_exit", "docker-compose.yaml"
)
@fixture(scope="class")
def slow_service(docker_services) -> None:
docker_services.wait_until_responsive(
timeout=30.0, pause=10, check=lambda: check_slow_service()
)
The test test_exit.py
lies beside conftest.py
, I can only seem to run the test successfully if I pass pytest the full path to the directory containing them both...
Apologies. All of this was because it turns out somewhere in our test code, someone was clearing the os environment variables... 🙃
Hey folks,
I'm having a strange issue where I get:
If I run my
pytest
tests usingpytest-docker
from a Makefile target.I'm using virtualenv for packages and I can run the tests fine like so:
But if I call my Makefile target which looks like:
Does anyone have any ideas as to why this might be breaking?
I notice that
which docker-compose
gives me different outputs:When run from outside of make:
When run inside make:
I understand that in the docs you recommend installing
docker-compose
as a python package, but it seems like that's done regardless upon installingpytest-docker
. Either way though, I'm still unsure as to why runningpytest
outside of make works and inside it doesn't 🙁Any help is appreciated!