]> granicus.if.org Git - graphviz/commitdiff
Make test_installation.py self-contained to run also on Windows
authorMagnus Jacobsson <magnus.jacobsson@berotec.se>
Mon, 27 Jul 2020 10:46:52 +0000 (12:46 +0200)
committerMagnus Jacobsson <magnus.jacobsson@berotec.se>
Thu, 30 Jul 2020 14:11:12 +0000 (16:11 +0200)
Also removed the now obsolete check_installation.sh bash script.

.gitlab-ci.yml
tests/regression_tests/installation/Makefile.am
tests/regression_tests/installation/check_installation.sh [deleted file]
tests/regression_tests/installation/test_installation.py

index 77405a6cb17ad86eda970317e28dc36c9540322e..93527be64396f8e12c6927765832726e321a43c6 100644 (file)
@@ -92,7 +92,7 @@ portable-source:
               msbuild /p:Configuration=$env:configuration
             }
         # Package
-        - $GV_VERSION=$( cat VERSION )
+        - $Env:GV_VERSION=$( cat VERSION )
         - >-
             if($env:platform -eq "x64") {
                 $API = "win64";
@@ -172,6 +172,7 @@ portable-source:
     stage: test
     script:
         - ci/install-packages.sh
+        - export GV_VERSION=$( cat VERSION )
         - python3 -m pytest --junitxml=report.xml tests rtest
     artifacts:
         reports:
index 1fe871c88d4d486fda3fa8edc8fb6da09208341d..55b238068c298700c1b42370f8fc679e0a0a488f 100644 (file)
@@ -1,6 +1,5 @@
 check test rtest:
-       ./check_installation.sh
+       python3 -m pytest
 
 EXTRA_DIST = \
-       check_installation.sh \
        test_installation.py
diff --git a/tests/regression_tests/installation/check_installation.sh b/tests/regression_tests/installation/check_installation.sh
deleted file mode 100755 (executable)
index 33e34ba..0000000
+++ /dev/null
@@ -1 +0,0 @@
-dot -V 2>&1 | grep "dot - graphviz version ${GV_VERSION}" || (dot -V && false)
index daf43b3281913e8b8d3cea7b511c0b0c07212789..7985efaceecba1f5d7c668cd9c021665ccea8852 100644 (file)
@@ -1,9 +1,19 @@
+import pytest
 import subprocess
 import os
 
 def test_installation():
-    os.chdir(os.path.dirname(os.path.realpath(__file__)))
-    result = subprocess.Popen(['bash', './check_installation.sh'])
-    text = result.communicate()[0]
-    print(text)
-    assert result.returncode == 0
+    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('Malformed version string: {0}'.format(actual_version_string))
+    assert actual_version == expected_version