From 97319323aec9028bd4bf65bb9db9fde491d58650 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 16 Apr 2021 13:01:38 +0100 Subject: [PATCH] Log the test outcome --- .pylint-spelling-words | 2 ++ changelog/52.improvement.rst | 1 + src/saltfactories/plugins/__init__.py | 10 ++++++++++ 3 files changed, 13 insertions(+) create mode 100644 changelog/52.improvement.rst diff --git a/.pylint-spelling-words b/.pylint-spelling-words index 1f92ee52..ce6968d4 100644 --- a/.pylint-spelling-words +++ b/.pylint-spelling-words @@ -118,6 +118,7 @@ ret returncode rst rtype +runtest saltapi saltcloud saltenv @@ -151,6 +152,7 @@ sysinfo sysstats systemd systemdsaltdaemonimpl +teardown tempfile tempfiles testname diff --git a/changelog/52.improvement.rst b/changelog/52.improvement.rst new file mode 100644 index 00000000..4af10227 --- /dev/null +++ b/changelog/52.improvement.rst @@ -0,0 +1 @@ +Log the test outcome diff --git a/src/saltfactories/plugins/__init__.py b/src/saltfactories/plugins/__init__.py index e89c2f1a..cba447bf 100644 --- a/src/saltfactories/plugins/__init__.py +++ b/src/saltfactories/plugins/__init__.py @@ -61,6 +61,16 @@ def pytest_runtest_logfinish(nodeid): log.debug("<<<<<<< END %s <<<<<<<", nodeid) +def pytest_runtest_logreport(report): + """ + Process the :py:class:`_pytest.reports.TestReport` produced for each + of the setup, call and teardown runtest phases of an item. + See :func:`pytest_runtest_protocol` for a description of the runtest protocol. + """ + if report.when == "call": + log.debug("======= %s %s ========", report.outcome.upper(), report.nodeid) + + @pytest.hookimpl(trylast=True) def pytest_load_initial_conftests(*_): """