Fix "message" parameter of pytest.raises
Removed in version 5.0 of pytest https://docs.pytest.org/en/7.0.x/deprecations.html#message-parameter-of-pytest-raises
This commit is contained in:
parent
8c8323308b
commit
311369691f
|
@ -75,14 +75,14 @@ def test_erase_basic():
|
|||
def test_validate_device_data_storage():
|
||||
"""Checks the validation for data-storage-only actions works."""
|
||||
# We can't set a GraphicCard
|
||||
with pytest.raises(TypeError,
|
||||
message='EraseBasic.device must be a DataStorage '
|
||||
'but you passed <GraphicCard None model=\'foo-bar\' S/N=\'foo\'>'):
|
||||
with pytest.raises(TypeError):
|
||||
models.EraseBasic(
|
||||
device=GraphicCard(serial_number='foo', manufacturer='bar', model='foo-bar'),
|
||||
clean_with_zeros=True,
|
||||
**conftest.T
|
||||
)
|
||||
pytest.fail('EraseBasic.device must be a DataStorage '
|
||||
'but you passed <GraphicCard None model=\'foo-bar\' S/N=\'foo\'>')
|
||||
|
||||
|
||||
@pytest.mark.mvp
|
||||
|
|
|
@ -24,11 +24,14 @@ def test_authenticate_error(app: Devicehub):
|
|||
MESSAGE = 'Provide a suitable token.'
|
||||
create_user()
|
||||
# Token doesn't exist
|
||||
with pytest.raises(Unauthorized, message=MESSAGE):
|
||||
with pytest.raises(Unauthorized):
|
||||
app.auth.authenticate(token=str(uuid4()))
|
||||
pytest.fail(MESSAGE)
|
||||
|
||||
# Wrong token format
|
||||
with pytest.raises(Unauthorized, message=MESSAGE):
|
||||
with pytest.raises(Unauthorized):
|
||||
app.auth.authenticate(token='this is a wrong uuid')
|
||||
pytest.fail(MESSAGE)
|
||||
|
||||
|
||||
@pytest.mark.mvp
|
||||
|
|
Reference in New Issue