From 59ed81f8387b1491890aa20482e2f1776ecf9970 Mon Sep 17 00:00:00 2001 From: Eric Soroos Date: Mon, 28 Dec 2020 13:48:46 +0100 Subject: [PATCH] Add pytest configuration for patching around an unknown valgrind mark --- Tests/conftest.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tests/conftest.py b/Tests/conftest.py index 082f2f7c3..1b2fffdc5 100644 --- a/Tests/conftest.py +++ b/Tests/conftest.py @@ -10,3 +10,18 @@ def pytest_report_header(config): return out.getvalue() except Exception as e: return f"pytest_report_header failed: {e}" + +def pytest_configure(config): + # We're marking some tests to ignore valgrind errors and XFAIL them. + # Ensure that the mark is defined even in cases where pytest-valgrind isn't installed + + import pytest + import warnings + + with warnings.catch_warnings(): + warnings.simplefilter("error") + try: + getattr(pytest.mark, "valgrind_known_error") + except: + config.addinivalue_line("markers", + "valgrind_known_error: Tests that have known issues with valgrind")