Skip to content

Commit 592550c

Browse files
committed
Make resaons for test failures clearer when checking if debugging options have been left on
This is to guard against optional Jax debugging options being inadvertently checked in.
1 parent d2e219a commit 592550c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

optimism/test/testJaxConfig.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,17 @@ def test_double_precision_mode_is_on(self):
1313
self.assertTrue(a.dtype == np.float64)
1414

1515
def test_debug_nans_is_off(self):
16-
np.log(-1.0)
16+
try:
17+
np.log(-1.0)
18+
except FloatingPointError:
19+
self.fail("Floating point exception raised. Check to see if 'jax_debug_nans' has been left activated from a debugging session.")
1720

1821
def test_debug_infs_is_off(self):
19-
a = np.array([1.0])
20-
a/0
22+
try:
23+
a = np.array([1.0])
24+
a/0
25+
except FloatingPointError:
26+
self.fail("Floating point exception raised. Check to see if 'jax_debug_infs' has been left activated from a debugging session.")
2127

2228
def test_jit_is_enabled(self):
2329
self.assertFalse(config.jax_disable_jit)

0 commit comments

Comments
 (0)