diff --git a/conftest.py b/conftest.py index 1d9c28d87..482044871 100644 --- a/conftest.py +++ b/conftest.py @@ -1,4 +1,5 @@ """Setup common stuff for pytests.""" + import os import pytest @@ -65,6 +66,15 @@ def pytest_addoption(parser): ) +def pytest_configure(config): + # Set the Agg backend for all test runs. This should be removed once + # xtgeo.plot is removed. This is to ensure that CI runs do not fail + # on Windows and macOS. + import matplotlib as mpl + + mpl.use("Agg") + + @pytest.fixture(name="generate_plot") def fixture_generate_plot(request): if "ROXENV" in os.environ: