From f6a4228e2d17fd554b88bcae512b966bc670f7b9 Mon Sep 17 00:00:00 2001 From: Giordon Stark Date: Wed, 19 Sep 2018 16:18:57 -0700 Subject: [PATCH] make sure we always reset backends, even if we don't set them explicitly --- tests/conftest.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 95cb280ee0..32fd1eedc0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2,6 +2,11 @@ import pyhf import tensorflow as tf +@pytest.fixture(scope='function', autouse=True) +def reset_backend(): + yield reset_backend + pyhf.set_backend(pyhf.default_backend) + @pytest.fixture(scope='function', params=[ (pyhf.tensor.numpy_backend(),), (pyhf.tensor.tensorflow_backend(session=tf.Session()),), @@ -50,5 +55,3 @@ def backend(request): pyhf.tensorlib.session = tf.Session() yield request.param - - pyhf.set_backend(pyhf.default_backend)