Skip to content

Commit

Permalink
Raise SkipTest before running setUp
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
apaszke committed Sep 18, 2023
1 parent 32ee27b commit 9fa96f8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/lobpcg_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 9fa96f8

Please sign in to comment.