summaryrefslogtreecommitdiffhomepage
path: root/test/conftest.py
diff options
context:
space:
mode:
authorAndrei Zeliankou <zelenkov@nginx.com>2020-12-08 14:37:33 +0000
committerAndrei Zeliankou <zelenkov@nginx.com>2020-12-08 14:37:33 +0000
commitb2e767819f04153944d525ef8d97d2f3a7a9af74 (patch)
tree29748112e707e1cdd3cb1b556a3f437114e5898a /test/conftest.py
parent8f916285639d7f9aac9ef03cace5e4dcbcca70cd (diff)
downloadunit-b2e767819f04153944d525ef8d97d2f3a7a9af74.tar.gz
unit-b2e767819f04153944d525ef8d97d2f3a7a9af74.tar.bz2
Tests: skip_alert() converted to the fixture.
Diffstat (limited to 'test/conftest.py')
-rw-r--r--test/conftest.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/test/conftest.py b/test/conftest.py
index 982e43c9..6783f16d 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -74,10 +74,6 @@ def pytest_configure(config):
fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, 0)
-def skip_alert(*alerts):
- option.skip_alerts.extend(alerts)
-
-
def pytest_generate_tests(metafunc):
cls = metafunc.cls
if (not hasattr(cls, 'application_type')
@@ -314,7 +310,7 @@ def _check_alerts(path=None):
alerts = re.findall(r'.+\[alert\].+', log)
if alerts:
- print('All alerts/sanitizer errors found in log:')
+ print('\nAll alerts/sanitizer errors found in log:')
[print(alert) for alert in alerts]
found = True
@@ -378,6 +374,14 @@ def stop_processes():
return 'Fail to stop process(es)'
+@pytest.fixture()
+def skip_alert():
+ def _skip(*alerts):
+ option.skip_alerts.extend(alerts)
+
+ return _skip
+
+
@pytest.fixture
def temp_dir(request):
return unit_instance['temp_dir']