From: Matthew Fernandez Date: Sun, 25 Oct 2020 02:49:43 +0000 (-0700) Subject: adjust installation test to work even if GV_VERSION is unset X-Git-Tag: 2.46.0~20^2^2~11^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c341a455821b902b961e0310f7fe4cb0602d6c85;p=graphviz adjust installation test to work even if GV_VERSION is unset This test should now run correctly in users' development environments as well as in CI. Related to #1851. --- diff --git a/tests/regression_tests/installation/test_installation.py b/tests/regression_tests/installation/test_installation.py index 7985eface..3c0877979 100644 --- a/tests/regression_tests/installation/test_installation.py +++ b/tests/regression_tests/installation/test_installation.py @@ -3,7 +3,16 @@ import subprocess import os def test_installation(): - expected_version = os.environ['GV_VERSION'] + expected_version = os.environ.get('GV_VERSION') + + # If $GV_VERSION is not set, run the CI step that derives it. This will fail + # if the user is in a snapshot directory without Git installed, but assume + # they can live with that. + if expected_version is None: + ROOT = os.path.join(os.path.dirname(__file__), '../../..') + expected_version = subprocess.check_output(['python3', + 'gen_version.py'], cwd=ROOT, universal_newlines=True).strip() + actual_version_string = subprocess.check_output( [ 'dot',