File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -37,18 +37,12 @@ def test_lazy_import_basics():
3737 # Now test that accessing attributes does what it should
3838 assert math .sin (math .pi ) == pytest .approx (0 , 1e-6 )
3939 # poor-mans pytest.raises for testing errors on attribute access
40- try :
40+ with pytest . raises ( ModuleNotFoundError ) :
4141 anything_not_real .pi
42- raise AssertionError () # Should not get here
43- except ModuleNotFoundError :
44- pass
4542 assert isinstance (anything_not_real , lazy .DelayedImportErrorModule )
4643 # see if it changes for second access
47- try :
44+ with pytest . raises ( ModuleNotFoundError ) :
4845 anything_not_real .pi
49- raise AssertionError () # Should not get here
50- except ModuleNotFoundError :
51- pass
5246
5347
5448def test_lazy_import_subpackages ():
@@ -88,11 +82,8 @@ def test_lazy_import_nonbuiltins():
8882 if not isinstance (np , lazy .DelayedImportErrorModule ):
8983 assert np .sin (np .pi ) == pytest .approx (0 , 1e-6 )
9084 if isinstance (sp , lazy .DelayedImportErrorModule ):
91- try :
85+ with pytest . raises ( ModuleNotFoundError ) :
9286 sp .pi
93- raise AssertionError ()
94- except ModuleNotFoundError :
95- pass
9687
9788
9889def test_lazy_attach ():
You can’t perform that action at this time.
0 commit comments