Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'skeleton-docker/develop' into lineage/s…
Browse files Browse the repository at this point in the history
…keleton
  • Loading branch information
jsf9k committed Jul 28, 2023
2 parents 2eab6f4 + a9d6c92 commit ceefbf9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
--requirement requirements.txt
pre-commit
pytest
pytest-dockerc
python-on-whales
11 changes: 10 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,24 @@
"""
# Third-Party Libraries
import pytest
from python_on_whales import docker

MAIN_SERVICE_NAME = "update"


@pytest.fixture(scope="session")
def dockerc():
"""Start up the Docker composition."""
docker.compose.up(detach=True)
yield docker
docker.compose.down()


@pytest.fixture(scope="session")
def main_container(dockerc):
"""Return the main container from the Docker composition."""
# find the container by name even if it is stopped already
return dockerc.containers(service_names=[MAIN_SERVICE_NAME], stopped=True)[0]
return dockerc.compose.ps(services=[MAIN_SERVICE_NAME], all=True)[0]


def pytest_addoption(parser):
Expand Down
2 changes: 1 addition & 1 deletion tests/container_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test_container_count(dockerc):
"""Verify the test composition and container."""
# stopped parameter allows non-running containers in results
assert (
len(dockerc.containers(stopped=True)) == 1
len(dockerc.compose.ps(all=True)) == 2
), "Wrong number of containers were started."


Expand Down

0 comments on commit ceefbf9

Please sign in to comment.