]> granicus.if.org Git - graphviz/commitdiff
adjust installation test to work even if GV_VERSION is unset
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 25 Oct 2020 02:49:43 +0000 (19:49 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 25 Oct 2020 18:47:27 +0000 (11:47 -0700)
This test should now run correctly in users' development environments as well as
in CI. Related to #1851.

tests/regression_tests/installation/test_installation.py

index 7985efaceecba1f5d7c668cd9c021665ccea8852..3c0877979ed3c2752504a4e3bf6e0734736cf32c 100644 (file)
@@ -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',