Skip to content

Commit 25970e8

Browse files
jpassaromndeveciCoshUSmoelasmarmildaniel
authored
chore: fix integration test for mismatched python version (#248)
* fix integration test for mismatched python version Teach integration test to pass when the "wrong" version of python is present but has no `pip` module. * use cross-version compatible assertion * lint/black fix Co-authored-by: Mehmet Nuri Deveci <[email protected]> Co-authored-by: Wilton_ <[email protected]> Co-authored-by: Mohamed Elasmar <[email protected]> Co-authored-by: Daniel Mil <[email protected]>
1 parent 58f4034 commit 25970e8

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/integration/workflows/python_pip/test_python_pip.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import os
22
import shutil
3+
import six
34
import sys
45
import platform
56
import tempfile
@@ -137,7 +138,15 @@ def test_mismatch_runtime_python_project(self):
137138
runtime=self.runtime_mismatch[self.runtime],
138139
)
139140
except WorkflowFailedError as ex:
140-
self.assertIn("Binary validation failed", str(ex))
141+
# handle both e.g. missing /usr/bin/python2.7 and situation where
142+
# python2.7 does not have pip installed (as is the case in some
143+
# Mac environments)
144+
ex_s = str(ex)
145+
if (
146+
"Binary validation failed" not in ex_s
147+
and "pip executable not found in your python environment" not in ex_s
148+
):
149+
six.raise_from(AssertionError("Unexpected exception"), ex)
141150

142151
def test_runtime_validate_python_project_fail_open_unsupported_runtime(self):
143152
with self.assertRaises(WorkflowFailedError):

0 commit comments

Comments
 (0)