From: Matthew Fernandez Date: Sat, 26 Mar 2022 19:40:01 +0000 (-0700) Subject: tests: move 'XType' stripping into a library function X-Git-Tag: 4.0.0~150^2~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a885a75b7d782506a8b7021cdf3beec133add26d;p=graphviz tests: move 'XType' stripping into a library function We will need to use this in another test case in an upcoming commit. --- diff --git a/rtest/gvtest.py b/rtest/gvtest.py index 0b0de55d8..a030c507e 100644 --- a/rtest/gvtest.py +++ b/rtest/gvtest.py @@ -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]: diff --git a/rtest/test_regression.py b/rtest/test_regression.py index 7c692cf09..8243e6ee4 100644 --- a/rtest/test_regression.py +++ b/rtest/test_regression.py @@ -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