Accept only my exception when testing Noparallel
This commit is contained in:
parent
909967629b
commit
87fc8ced5e
1 changed files with 6 additions and 3 deletions
|
@ -132,15 +132,18 @@ class TestNoparallel:
|
||||||
assert 1.2 > taken >= 1.0 # 2 * 0.5s count = ~1s
|
assert 1.2 > taken >= 1.0 # 2 * 0.5s count = ~1s
|
||||||
|
|
||||||
def testException(self, queue_spawn):
|
def testException(self, queue_spawn):
|
||||||
|
class MyException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
@util.Noparallel()
|
@util.Noparallel()
|
||||||
def raiseException():
|
def raiseException():
|
||||||
raise Exception("Test error!")
|
raise MyException("Test error!")
|
||||||
|
|
||||||
with pytest.raises(Exception) as err:
|
with pytest.raises(MyException) as err:
|
||||||
raiseException()
|
raiseException()
|
||||||
assert str(err.value) == "Test error!"
|
assert str(err.value) == "Test error!"
|
||||||
|
|
||||||
with pytest.raises(Exception) as err:
|
with pytest.raises(MyException) as err:
|
||||||
queue_spawn(raiseException).get()
|
queue_spawn(raiseException).get()
|
||||||
assert str(err.value) == "Test error!"
|
assert str(err.value) == "Test error!"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue