Skip to content

Commit

Permalink
Merge pull request #216 from cisagov/improvement/use_semver_for_versi…
Browse files Browse the repository at this point in the history
…on_comparisons

Use the `semver` package to parse the log version in testing
  • Loading branch information
mcdonnnj authored Feb 18, 2025
2 parents e8ec18b + e51d105 commit 0a2e987
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 0 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
--requirement requirements-test.txt
ipython
pipenv
# The bump-version script requires at least version 3 of semver.
semver>=3
2 changes: 2 additions & 0 deletions requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
pre-commit
pytest
python-on-whales
# The bump-version script requires at least version 3 of semver.
semver>=3
7 changes: 4 additions & 3 deletions tests/container_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

# Third-Party Libraries
import pytest
from semver import parse_version_info

ENV_VAR = "ECHO_MESSAGE"
ENV_VAR_VAL = "Hello World from docker compose!"
Expand Down Expand Up @@ -71,9 +72,9 @@ def test_log_version(dockerc, project_version, version_container):
"""Verify the container outputs the correct version to the logs."""
# make sure container exited if running test isolated
dockerc.wait(version_container.id)
log_output = version_container.logs().strip()
assert (
log_output == project_version
log_version = parse_version_info(version_container.logs().strip())
assert log_version == parse_version_info(
project_version
), f"Container version output to log does not match project version file {VERSION_FILE}"


Expand Down

0 comments on commit 0a2e987

Please sign in to comment.