]> granicus.if.org Git - graphviz/commitdiff
tests: move 'XType' stripping into a library function
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 26 Mar 2022 19:40:01 +0000 (12:40 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 29 Mar 2022 23:44:36 +0000 (16:44 -0700)
We will need to use this in another test case in an upcoming commit.

rtest/gvtest.py
rtest/test_regression.py

index 0b0de55d8c5298c169fd861f71a97d88793ab03e..a030c507e137c8e64c91c991f124cf115207af52 100644 (file)
@@ -3,6 +3,7 @@
 import os
 from pathlib import Path
 import platform
+import re
 import shlex
 import shutil
 import subprocess
@@ -117,6 +118,18 @@ def is_mingw() -> bool:
   """is the current platform MinGW?"""
   return "mingw" in sysconfig.get_platform()
 
+def remove_xtype_warnings(s: str) -> str:
+  """
+  Remove macOS XType warnings from a string. These appear to be harmless, but
+  occur in CI.
+  """
+
+  # avoid doing this anywhere except on macOS
+  if platform.system() != "Darwin":
+    return s
+
+  return re.sub(r"^.* XType: .*\.$", "", s, flags=re.MULTILINE)
+
 def run_c(src: Path, args: List[str] = None, input: str = "",
           cflags: List[str] = None, link: List[str] = None
           ) -> Tuple[str, str]:
index 7c692cf099a9024dbe5d9a88ac594fdbe6f1f5c4..8243e6ee4b386cf0817a814d68c9d7e1e8e5f2d0 100644 (file)
@@ -21,7 +21,8 @@ import xml.etree.ElementTree as ET
 import pytest
 
 sys.path.append(os.path.dirname(__file__))
-from gvtest import dot, gvpr, is_mingw, ROOT, run_c #pylint: disable=C0413
+from gvtest import dot, gvpr, is_mingw, ROOT, remove_xtype_warnings, run_c \
+  #pylint: disable=C0413
 
 def is_ndebug_defined() -> bool:
   """
@@ -34,18 +35,6 @@ def is_ndebug_defined() -> bool:
 
   return False
 
-def remove_xtype_warnings(s: str) -> str:
-  """
-  Remove macOS XType warnings from a string. These appear to be harmless, but
-  occur in CI.
-  """
-
-  # avoid doing this anywhere except on macOS
-  if platform.system() != "Darwin":
-    return s
-
-  return re.sub(r"^.* XType: .*\.$", "", s, flags=re.MULTILINE)
-
 # The terminology used in rtest.py is a little inconsistent. At the
 # end it reports the total number of tests, the number of "failures"
 # (crashes) and the number of "changes" (which is the number of tests