We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d61b3d8 commit 781372eCopy full SHA for 781372e
tests/conftest.py
@@ -1,6 +1,6 @@
1
-import logging
2
-
3
import keras
+import logging
+import matplotlib
4
import pytest
5
6
BACKENDS = ["jax", "numpy", "tensorflow", "torch"]
@@ -17,6 +17,16 @@ def pytest_runtest_setup(item):
17
if test_backends and backend not in test_backends:
18
pytest.skip(f"Skipping backend '{backend}' for test {item}, which is registered for backends {test_backends}.")
19
20
+ # use a non-GUI plotting backend for tests
21
+ matplotlib.use("Agg")
22
+
23
24
+def pytest_runtest_teardown(item, nextitem):
25
+ import matplotlib.pyplot as plt
26
27
+ # close all plots at the end of each test
28
+ plt.close("all")
29
30
31
def pytest_make_parametrize_id(config, val, argname):
32
return f"{argname}={repr(val)}"
0 commit comments