From 9fa96f8bdf9a031154057e5b26febd5357a1e80e Mon Sep 17 00:00:00 2001 From: Adam Paszke Date: Mon, 18 Sep 2023 15:28:00 +0000 Subject: [PATCH] Raise SkipTest before running setUp If `setUp` raises, then `tearDown` is never run. This, in conjunction with `jtu.with_config` leads to leaked configs and causes downstreram test failures due to NaN checking. --- tests/lobpcg_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/lobpcg_test.py b/tests/lobpcg_test.py index b56c14312ed5..1a4b503b021a 100644 --- a/tests/lobpcg_test.py +++ b/tests/lobpcg_test.py @@ -368,10 +368,10 @@ def checkApproxEigs(self, example_name, dtype): class F32LobpcgTest(LobpcgTest): def setUp(self): - super().setUp() # TODO(phawkins): investigate this failure if jtu.device_under_test() == "gpu": raise unittest.SkipTest("Test is failing on CUDA gpus") + super().setUp() def testLobpcgValidatesArguments(self): A, _ = _concrete_generators(np.float32)['id'](100, 10) @@ -408,10 +408,10 @@ def testCallableMatricesF32(self, matrix_name): class F64LobpcgTest(LobpcgTest): def setUp(self): - super().setUp() # TODO(phawkins): investigate this failure if jtu.device_under_test() == "gpu": raise unittest.SkipTest("Test is failing on CUDA gpus") + super().setUp() @parameterized.named_parameters(_make_concrete_cases(f64=True)) @jtu.skip_on_devices("tpu", "iree", "gpu")