From b681bbc69e15171429ee5ea48a1282ba83fdc30c Mon Sep 17 00:00:00 2001 From: "arjxn.py" Date: Thu, 9 Nov 2023 23:54:54 +0530 Subject: [PATCH] Add test for case if dependency is available --- tests/unit/test_util.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_util.py b/tests/unit/test_util.py index 8edf4ad6ec..7b6864f443 100644 --- a/tests/unit/test_util.py +++ b/tests/unit/test_util.py @@ -101,10 +101,9 @@ def test_have_optional_dependency(self): model.initial_conditions = {v: 1} sim = pybamm.Simulation(model) sim.solve([0, 1]) - with self.assertRaisesRegex(ModuleNotFoundError,"Optional dependency autograd is not available. See https://docs.pybamm.org/en/latest/source/user_guide/installation/index.html#optional-dependencies for more details."): - sys.modules['autograd'] = None - a = pybamm.StateVector(slice(0, 1)) - pybamm.Function(test_function, a) + + sys.modules['pybtex'] = pybamm.util.have_optional_dependency("pybtex") + pybamm.print_citations() class TestSearch(TestCase):