Skip to content

Commit 73f479f

Browse files
committed
Instead of 'echo' let's use 'env' and grep to PYTHON_VERSION
variable. Afterwards let's check right side of the variable against 'python --version' Signed-off-by: Petr "Stone" Hracek <[email protected]>
1 parent 7b2e05b commit 73f479f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

test/test_container_application.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_application(self, build_s2i_app, container_args):
4949
python_version_output = PodmanCLIWrapper.podman_run_command_and_remove(
5050
cid_file_name=VARS.IMAGE_NAME, cmd="python --version"
5151
)
52-
assert f"Python {python_version}." in python_version_output
52+
assert f"Python {VARS.VERSION_NO_MINIMAL}." in python_version_output
5353
cip = build_s2i_app.get_cip(cid_file_name=cid_file_name)
5454
assert cip
5555
port = 8080
@@ -102,14 +102,14 @@ def test_unstable_test(self, unstable_app):
102102
cid_file_name=cid_file_name,
103103
container_args=s2i_app_unstable,
104104
)
105-
assert ContainerImage.wait_for_cid(cid_file_name=cid_file_name)
106105
python_version = PodmanCLIWrapper.podman_run_command_and_remove(
107-
cid_file_name=VARS.IMAGE_NAME, cmd="echo \\$PYTHON_VERSION"
106+
cid_file_name=VARS.IMAGE_NAME, cmd="env | grep PYTHON_VERSION"
108107
).strip()
108+
assert ContainerImage.wait_for_cid(cid_file_name=cid_file_name)
109109
python_version_output = PodmanCLIWrapper.podman_run_command_and_remove(
110110
cid_file_name=VARS.IMAGE_NAME, cmd="python --version"
111111
)
112-
assert f"Python {python_version}." in python_version_output
112+
assert f"Python {python_version.split('=')[1]}." in python_version_output
113113
cip = s2i_app_unstable.get_cip(cid_file_name=cid_file_name)
114114
assert cip
115115
port = 8080

test/test_container_basics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ def test_scl_usage(self):
4848
Test if python --version returns proper output
4949
"""
5050
python_version = PodmanCLIWrapper.podman_run_command_and_remove(
51-
cid_file_name=VARS.IMAGE_NAME, cmd="echo \\$PYTHON_VERSION"
51+
cid_file_name=VARS.IMAGE_NAME, cmd="env | grep PYTHON_VERSION"
5252
).strip()
5353
python_version_output = PodmanCLIWrapper.podman_run_command_and_remove(
5454
cid_file_name=VARS.IMAGE_NAME, cmd="python --version"
5555
)
56-
assert f"Python {python_version}." in python_version_output
56+
assert f"Python {python_version.split('=')[1]}." in python_version_output
5757
if not VARS.IS_MINIMAL:
5858
assert (
5959
re.search(

0 commit comments

Comments
 (0)