]> granicus.if.org Git - graphviz/commitdiff
suppress XType warnings during testing on macOS
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 26 Jan 2022 07:25:46 +0000 (18:25 +1100)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 27 Jan 2022 09:32:36 +0000 (20:32 +1100)
When upgrading from macOS 11 to macOS 12 in CI, running Graphviz outputs:

  dot[32116:62347] XType: com.apple.fonts is not accessible.
  dot[32116:62347] XType: XTFontStaticRegistry is enabled.

This causes some spurious failures in tests that are expecting stderr to be
silent. These warnings do not seem a serious issue, so this change suppresses
them during testing.

Gitlab: #2164

rtest/test_regression.py

index 4ae3eac1c6d83f2f8d1fc95d3af9f742c43a1f71..267d52f455917c8ab2e83674f11fcc811c80d764 100644 (file)
@@ -42,6 +42,18 @@ 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
@@ -447,7 +459,8 @@ def test_1444():
 
     assert p.returncode == 0, "failed to process a headport edge"
 
-  assert stderr.strip() == "", "emitted an error for a legal graph"
+  stderr = remove_xtype_warnings(stderr).strip()
+  assert stderr == "", "emitted an error for a legal graph"
 
   # now locate our second variant, that simply has the attributes swapped
   input2 = Path(__file__).parent / "1444-2.dot"
@@ -460,7 +473,8 @@ def test_1444():
 
     assert p.returncode == 0, "failed to process a headport edge"
 
-  assert stderr.strip() == "", "emitted an error for a legal graph"
+  stderr = remove_xtype_warnings(stderr).strip()
+  assert stderr == "", "emitted an error for a legal graph"
 
   assert stdout1 == stdout2, \
     "swapping edge attributes altered the output graph"
@@ -998,7 +1012,7 @@ def test_1913():
                           stdin=subprocess.PIPE, stderr=subprocess.PIPE,
                           universal_newlines=True) as p:
       _, stderr = p.communicate(input)
-      return p.returncode, stderr
+      return p.returncode, remove_xtype_warnings(stderr)
 
   # Graphviz should accept all legal values for this attribute
   for align in ("left", "right", "center"):