]> granicus.if.org Git - graphviz/commitdiff
Simplify pytests that call rtest.py
authorMagnus Jacobsson <magnus.jacobsson@berotec.se>
Thu, 6 Aug 2020 15:16:44 +0000 (17:16 +0200)
committerMagnus Jacobsson <magnus.jacobsson@berotec.se>
Thu, 6 Aug 2020 16:24:08 +0000 (18:24 +0200)
rtest/test_regression.py

index 2deb39230ba505c131a875080b45b67b349fa2ab..617f35edd81695e53846f2f688270e3eaaa5c037 100644 (file)
@@ -17,10 +17,7 @@ import re
 
 def test_regression_subset_differences():
     os.chdir(os.path.dirname(os.path.realpath(__file__)))
-    result = subprocess.Popen(['python3', 'rtest.py', 'tests_subset.txt'], stderr=subprocess.PIPE)
-    text = result.communicate()[1]
-    print(text)
-    assert result.returncode == 0
+    subprocess.check_call(['python3', 'rtest.py', 'tests_subset.txt'])
 
 # Secondly, run all tests but ignore differences and fail the test
 # only if there is a crash. This will leave the differences for png
@@ -28,10 +25,11 @@ def test_regression_subset_differences():
 
 def test_regression_failure():
     os.chdir(os.path.dirname(os.path.realpath(__file__)))
-    result = subprocess.Popen(['python3', 'rtest.py'], stderr=subprocess.PIPE)
+    result = subprocess.Popen(['python3', 'rtest.py'], stderr=subprocess.PIPE,
+                              universal_newlines=True)
     text = result.communicate()[1]
     print(text)
-    assert "Layout failures: 0" in str(text)
+    assert "Layout failures: 0" in text
 # FIXME: re-enable when all tests pass on all platforms
 #    assert result.returncode == 0