frostfs-testlib/src/frostfs_testlib/utils/errors.py
Aleksei Chetaev 44e9a8480a Move errors patterns and check functions to testlib
Signed-off-by: Aleksei Chetaev <alex.chetaev@gmail.com>
2023-02-17 14:35:14 +01:00

11 lines
308 B
Python

import re
def error_matches_status(error: Exception, status_pattern: str) -> bool:
"""
Determines whether exception matches specified status pattern.
We use re.search() to be consistent with pytest.raises.
"""
match = re.search(status_pattern, str(error))
return match is not None