From c341a455821b902b961e0310f7fe4cb0602d6c85 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 24 Oct 2020 19:49:43 -0700 Subject: [PATCH] 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. --- .../installation/test_installation.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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', -- 2.40.0