]> granicus.if.org Git - graphviz/commitdiff
move installation test into CI-only tests
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 24 Mar 2022 02:24:52 +0000 (19:24 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 29 Mar 2022 15:29:07 +0000 (08:29 -0700)
This test was introduced in !1347¹ in response to some version confusion due to
the Graphviz version being generated in several different places. Locally, this
test could fail misleadingly if the developer had new commits in their Graphviz
checkout and had not recompiled. But these failures are not relevant; running
the test suite against a slightly different version of Graphviz should not
unconditionally fail one of the tests. Moreover a developer working locally is
generally only running a single work flow, so their local Graphviz version is
generated in a single place.

The place where we do worry about version divergence is in CI, where the steps
for generating the Graphviz version for different platforms are in different
places and can accidentally skew. So this change makes the test only run in CI,
not locally.

Note that we can also drop the conditional logic to recover the version from the
GRAPHVIZ_VERSION file because the `$GV_VERSION` environment variable is defined
in all the CI testing jobs.

¹ https://gitlab.com/graphviz/graphviz/-/merge_requests/1347

ci/tests.py
configure.ac
tests/regression_tests/Makefile.am
tests/regression_tests/installation/Makefile.am [deleted file]
tests/regression_tests/installation/test_installation.py [deleted file]

index a2a2dae10825a24a5472d5410bfb98276f02ca7f..4d9c8777bbf49c4fac0731cfd5391d44d28e8f08 100644 (file)
@@ -8,6 +8,7 @@ import os
 from pathlib import Path
 import platform
 import shutil
+import subprocess
 import sys
 from typing import Dict
 import pytest
@@ -195,3 +196,24 @@ def test_1786():
 
   # run a trivial graph through Graphviz
   dot("png:gd", source="digraph { a -> b; }")
+
+def test_installation():
+  """
+  check that Graphviz reports the expected version number
+  """
+
+  expected_version = os.environ["GV_VERSION"]
+
+  actual_version_string = subprocess.check_output(
+      [
+          "dot",
+          "-V",
+      ],
+      universal_newlines=True,
+      stderr=subprocess.STDOUT,
+  )
+  try:
+    actual_version = actual_version_string.split()[4]
+  except IndexError:
+    pytest.fail(f"Malformed version string: {actual_version_string}")
+  assert actual_version == expected_version
index 703ee104826a387ad04d09fc27d89e007bfef599..02e15c65741d88faa7dafece59efd44acd8f31a7 100644 (file)
@@ -2746,7 +2746,6 @@ AC_CONFIG_FILES(Makefile
        tests/unit_tests/lib/Makefile
        tests/unit_tests/lib/common/Makefile
        tests/regression_tests/Makefile
-       tests/regression_tests/installation/Makefile
        tests/regression_tests/shapes/Makefile
        tests/regression_tests/shapes/reference/Makefile
        tests/regression_tests/vuln/Makefile
index 41125d9f3151b5b83b38c7cc05749fa4145ea0c3..ea04cf01fca5c7fe27d181cd48e7ba56fb8d0934 100644 (file)
@@ -1,3 +1,3 @@
-SUBDIRS = installation shapes vuln
+SUBDIRS = shapes vuln
 
 EXTRA_DIST = regression_test_helpers.py
diff --git a/tests/regression_tests/installation/Makefile.am b/tests/regression_tests/installation/Makefile.am
deleted file mode 100644 (file)
index 438b220..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-EXTRA_DIST = \
-       test_installation.py
diff --git a/tests/regression_tests/installation/test_installation.py b/tests/regression_tests/installation/test_installation.py
deleted file mode 100644 (file)
index b0f5951..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-"""
-Graphviz version consistency tests
-"""
-
-import os
-from pathlib import Path
-import subprocess
-import sys
-import pytest
-
-def test_installation():
-  """
-  check that Graphviz reports the expected version number
-  """
-
-  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 = Path(__file__).parent.parent.parent.parent
-    expected_version = subprocess.check_output([sys.executable,
-      "gen_version.py"], cwd=ROOT, universal_newlines=True).strip()
-
-  actual_version_string = subprocess.check_output(
-      [
-          "dot",
-          "-V",
-      ],
-      universal_newlines=True,
-      stderr=subprocess.STDOUT,
-  )
-  try:
-    actual_version = actual_version_string.split()[4]
-  except IndexError:
-    pytest.fail(f"Malformed version string: {actual_version_string}")
-  assert actual_version == expected_version