some new features

This commit is contained in:
ilgazca
2025-07-30 17:09:11 +03:00
parent db5d46760a
commit 8019bd3b7c
20616 changed files with 4375466 additions and 8 deletions

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
import contextlib
import pytest
def pytest_error_str(error):
"""Different for different versions of Pytest"""
try:
return str(error.value)
except AttributeError:
return str(error)
def pytest_warning_messages(warnings):
"""Get the warning messages for captured warnings"""
return [str(w.message) for w in warnings.list]
@contextlib.contextmanager
def raises(exception):
"""Allows context managers for catching NO errors"""
if exception is None:
yield None
else:
with pytest.raises(exception) as e:
yield e