From ef0531c25a2c9f31eededd59b29915261d5e0bab Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Fri, 24 Jan 2025 15:43:55 -0500 Subject: [PATCH 01/14] add TAP logging --- conftest.py | 5 +++++ src/pytest_tap/plugin.py | 29 ++++++++++++++++++++++++++--- tests/test_help.py | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/conftest.py b/conftest.py index 23c5555..fb63542 100644 --- a/conftest.py +++ b/conftest.py @@ -8,11 +8,16 @@ def sample_test_file(testdir): testdir.makepyfile( """ import pytest + import logging + + LOGGER = logging.getLogger(__name__) def test_ok(): + LOGGER.info("Running test_ok") assert True def test_not_ok(): + LOGGER.error("Running test_not_ok") assert False @pytest.mark.parametrize('param', ("foo", "bar")) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index 95e40e5..51a268a 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -25,6 +25,8 @@ def __init__(self, config: pytest.Config) -> None: # Disable it automatically for streaming. self._tracker.header = False + self.tap_logging = config.option.tap_logging + @pytest.hookimpl() def pytest_runtestloop(self, session): """Output the plan line first.""" @@ -72,7 +74,7 @@ def pytest_runtest_logreport(self, report: pytest.TestReport): elif report.passed: self._tracker.add_ok(testcase, description) elif report.failed: - diagnostics = _make_as_diagnostics(report) + diagnostics = _make_as_diagnostics(report, self.tap_logging) # pytest treats an unexpected success from unitest.expectedFailure # as a failure. @@ -143,6 +145,14 @@ def pytest_addoption(parser): "If the directory does not exist, it will be created." ), ) + group.addoption( + "--tap-logging", + default="no", + help=( + "Write captured log messages to TAP report: one of" + "no|log|system-out|system-err|out-err|all" + ), + ) @pytest.hookimpl(trylast=True) @@ -161,7 +171,20 @@ def pytest_configure(config: pytest.Config) -> None: config.pluginmanager.register(TAPPlugin(config), "tapplugin") -def _make_as_diagnostics(report): +def _make_as_diagnostics(report, tap_logging): """Format a report as TAP diagnostic output.""" lines = report.longreprtext.splitlines(keepends=True) - return format_as_diagnostics(lines) + + content_all = format_as_diagnostics(lines) + + if tap_logging in ["log", "all"]: + content_all += format_as_diagnostics(" Captured Log ") + content_all += format_as_diagnostics(report.caplog.splitlines(keepends=True)) + if tap_logging in ["system-out", "out-err", "all"]: + content_all += format_as_diagnostics(" Captured Out ") + content_all += format_as_diagnostics(report.capstdout.splitlines(keepends=True)) + if tap_logging in ["system-err", "out-err", "all"]: + content_all += format_as_diagnostics(" Captured Err ") + content_all += format_as_diagnostics(report.capstderr.splitlines(keepends=True)) + + return content_all diff --git a/tests/test_help.py b/tests/test_help.py index 38bf3ac..f671282 100644 --- a/tests/test_help.py +++ b/tests/test_help.py @@ -7,6 +7,7 @@ def test_includes_options(testdir): "*--tap-files*", "*--tap-combined*", "*--tap-outdir=path*", + "*--tap-logging*" ] result.stdout.fnmatch_lines(expected_option_flags) From 92b242972c5b6b3ea71302f468aab77189d49b3c Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Fri, 24 Jan 2025 15:45:00 -0500 Subject: [PATCH 02/14] Update AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 8a6f5ee..4caf02b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,7 @@ Contributors ------------ * Allison Karlitskaya +* Cody D'Ambrosio * Dan Dofter * Erik Cederstrand * Frédéric Mangano-Tarumi From 5e598b383bce97303b8567d9cdab18712f525f88 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 20:45:14 +0000 Subject: [PATCH 03/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_help.py b/tests/test_help.py index f671282..07ea834 100644 --- a/tests/test_help.py +++ b/tests/test_help.py @@ -7,7 +7,7 @@ def test_includes_options(testdir): "*--tap-files*", "*--tap-combined*", "*--tap-outdir=path*", - "*--tap-logging*" + "*--tap-logging*", ] result.stdout.fnmatch_lines(expected_option_flags) From 24889feb53421ac5c7f706b333a754310b56d8d4 Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Fri, 24 Jan 2025 19:59:39 -0500 Subject: [PATCH 04/14] fix line breaks --- src/pytest_tap/plugin.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index 51a268a..7f83c4f 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -175,16 +175,14 @@ def _make_as_diagnostics(report, tap_logging): """Format a report as TAP diagnostic output.""" lines = report.longreprtext.splitlines(keepends=True) - content_all = format_as_diagnostics(lines) - if tap_logging in ["log", "all"]: - content_all += format_as_diagnostics(" Captured Log ") - content_all += format_as_diagnostics(report.caplog.splitlines(keepends=True)) + lines[-1] += "\n" + lines += [" Captured Log \n"] + (report.caplog.splitlines(keepends=True) or [""]) if tap_logging in ["system-out", "out-err", "all"]: - content_all += format_as_diagnostics(" Captured Out ") - content_all += format_as_diagnostics(report.capstdout.splitlines(keepends=True)) + lines[-1] += "\n" + lines += [" Captured Out \n"] + (report.capstdout.splitlines(keepends=True) or [""]) if tap_logging in ["system-err", "out-err", "all"]: - content_all += format_as_diagnostics(" Captured Err ") - content_all += format_as_diagnostics(report.capstderr.splitlines(keepends=True)) + lines[-1] += "\n" + lines += [" Captured Err \n"] + (report.capstderr.splitlines(keepends=True) or [""]) - return content_all + return format_as_diagnostics(lines) From 0bda07f16687990d746ac84298f0ca36f6162af5 Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Fri, 24 Jan 2025 20:00:25 -0500 Subject: [PATCH 05/14] add test --- tests/test_plugin.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 25c7dec..a26a878 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -85,6 +85,17 @@ def test_outdir(testdir, sample_test_file): testresults = outdir.join("testresults.tap") assert testresults.check() +def test_logging(testdir, sample_test_file): + """Test logs are added to TAP diagnostics.""" + result = testdir.runpytest_subprocess("--tap", "--tap-logging", "all") + result.stdout.fnmatch_lines( + [ + "# Captured Log", + "# Captured Out", + "# Captured Err", + "*Running test_not_ok*" + ] + ) def test_xfail_no_reason(testdir): """xfails output gracefully when no reason is provided.""" From 20115beda09817335ef9e04f88a3e9ab23b85147 Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Fri, 24 Jan 2025 20:08:29 -0500 Subject: [PATCH 06/14] improve log out --- src/pytest_tap/plugin.py | 6 +++--- tests/test_plugin.py | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index 7f83c4f..6bad32c 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -177,12 +177,12 @@ def _make_as_diagnostics(report, tap_logging): if tap_logging in ["log", "all"]: lines[-1] += "\n" - lines += [" Captured Log \n"] + (report.caplog.splitlines(keepends=True) or [""]) + lines += ["--- Captured Log ---\n"] + (report.caplog.splitlines(keepends=True) or [""]) if tap_logging in ["system-out", "out-err", "all"]: lines[-1] += "\n" - lines += [" Captured Out \n"] + (report.capstdout.splitlines(keepends=True) or [""]) + lines += ["--- Captured Out ---\n"] + (report.capstdout.splitlines(keepends=True) or [""]) if tap_logging in ["system-err", "out-err", "all"]: lines[-1] += "\n" - lines += [" Captured Err \n"] + (report.capstderr.splitlines(keepends=True) or [""]) + lines += ["--- Captured Err ---\n"] + (report.capstderr.splitlines(keepends=True) or [""]) return format_as_diagnostics(lines) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index a26a878..75d671b 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -90,10 +90,10 @@ def test_logging(testdir, sample_test_file): result = testdir.runpytest_subprocess("--tap", "--tap-logging", "all") result.stdout.fnmatch_lines( [ - "# Captured Log", - "# Captured Out", - "# Captured Err", - "*Running test_not_ok*" + "# --- Captured Log ---", + "*Running test_not_ok*", + "# --- Captured Out ---", + "# --- Captured Err ---", ] ) From 0fb4e008163a4670c68925d300b854f97740f2e0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 25 Jan 2025 01:08:37 +0000 Subject: [PATCH 07/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pytest_tap/plugin.py | 12 +++++++++--- tests/test_plugin.py | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index 6bad32c..999ec84 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -177,12 +177,18 @@ def _make_as_diagnostics(report, tap_logging): if tap_logging in ["log", "all"]: lines[-1] += "\n" - lines += ["--- Captured Log ---\n"] + (report.caplog.splitlines(keepends=True) or [""]) + lines += ["--- Captured Log ---\n"] + ( + report.caplog.splitlines(keepends=True) or [""] + ) if tap_logging in ["system-out", "out-err", "all"]: lines[-1] += "\n" - lines += ["--- Captured Out ---\n"] + (report.capstdout.splitlines(keepends=True) or [""]) + lines += ["--- Captured Out ---\n"] + ( + report.capstdout.splitlines(keepends=True) or [""] + ) if tap_logging in ["system-err", "out-err", "all"]: lines[-1] += "\n" - lines += ["--- Captured Err ---\n"] + (report.capstderr.splitlines(keepends=True) or [""]) + lines += ["--- Captured Err ---\n"] + ( + report.capstderr.splitlines(keepends=True) or [""] + ) return format_as_diagnostics(lines) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 75d671b..e45ac7e 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -85,6 +85,7 @@ def test_outdir(testdir, sample_test_file): testresults = outdir.join("testresults.tap") assert testresults.check() + def test_logging(testdir, sample_test_file): """Test logs are added to TAP diagnostics.""" result = testdir.runpytest_subprocess("--tap", "--tap-logging", "all") @@ -97,6 +98,7 @@ def test_logging(testdir, sample_test_file): ] ) + def test_xfail_no_reason(testdir): """xfails output gracefully when no reason is provided.""" testdir.makepyfile( From 5d5a0d9730e9ab0590dd8a3fa45a257239d0de7a Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Fri, 24 Jan 2025 20:15:14 -0500 Subject: [PATCH 08/14] add diagnostics to ok tests --- src/pytest_tap/plugin.py | 12 +++++++++++- tests/test_plugin.py | 11 +++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index 999ec84..e41c7fc 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -26,6 +26,7 @@ def __init__(self, config: pytest.Config) -> None: self._tracker.header = False self.tap_logging = config.option.tap_logging + self.tap_log_passing_tests = config.option.tap_log_passing_tests @pytest.hookimpl() def pytest_runtestloop(self, session): @@ -72,7 +73,10 @@ def pytest_runtest_logreport(self, report: pytest.TestReport): directive = "TODO unexpected success{}".format(reason) self._tracker.add_ok(testcase, description, directive=directive) elif report.passed: - self._tracker.add_ok(testcase, description) + diagnostics = None + if self.tap_log_passing_tests: + diagnostics = _make_as_diagnostics(report, self.tap_logging) + self._tracker.add_ok(testcase, description, diagnostics=diagnostics) elif report.failed: diagnostics = _make_as_diagnostics(report, self.tap_logging) @@ -153,6 +157,12 @@ def pytest_addoption(parser): "no|log|system-out|system-err|out-err|all" ), ) + group.addoption( + "--tap-log-passing-tests", + default=False, + action="store_true", + help="Capture log information for passing tests to TAP report" + ) @pytest.hookimpl(trylast=True) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index e45ac7e..2c2fb55 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -99,6 +99,17 @@ def test_logging(testdir, sample_test_file): ) +def test_log_passing_tests(testdir, sample_test_file): + """Test logs are added to TAP diagnostics.""" + result = testdir.runpytest_subprocess("--tap", "--tap-logging", "log", "--tap-log-passing-tests") + result.stdout.fnmatch_lines( + [ + "# --- Captured Log ---", + "*Running test_ok*", + ] + ) + + def test_xfail_no_reason(testdir): """xfails output gracefully when no reason is provided.""" testdir.makepyfile( From 3b74d1bd1c978701a570178552d3007307794d6c Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Sun, 26 Jan 2025 06:01:09 -0500 Subject: [PATCH 09/14] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1c809e0..fb9cb4a 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,7 @@ include_package_data=True, zip_safe=False, platforms="any", - install_requires=["pytest>=3.0", "tap.py>=3.0,<4.0"], + install_requires=["pytest>=3.0", "tap.py>=3.2,<4.0"], classifiers=[ "Development Status :: 5 - Production/Stable", "Framework :: Pytest", From 353740ee46d538687445218192892bc8054d59b6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 12:38:50 +0000 Subject: [PATCH 10/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pytest_tap/plugin.py | 2 +- tests/test_plugin.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index e41c7fc..d9b00c7 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -161,7 +161,7 @@ def pytest_addoption(parser): "--tap-log-passing-tests", default=False, action="store_true", - help="Capture log information for passing tests to TAP report" + help="Capture log information for passing tests to TAP report", ) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 2c2fb55..88c3ce8 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -101,7 +101,9 @@ def test_logging(testdir, sample_test_file): def test_log_passing_tests(testdir, sample_test_file): """Test logs are added to TAP diagnostics.""" - result = testdir.runpytest_subprocess("--tap", "--tap-logging", "log", "--tap-log-passing-tests") + result = testdir.runpytest_subprocess( + "--tap", "--tap-logging", "log", "--tap-log-passing-tests" + ) result.stdout.fnmatch_lines( [ "# --- Captured Log ---", From 8119666674f4aafe9d4c31cca03b3b9c44781ca5 Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Wed, 29 Jan 2025 09:42:06 -0500 Subject: [PATCH 11/14] fixes and cleanup --- src/pytest_tap/plugin.py | 18 ++++++++++++------ tests/test_plugin.py | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index d9b00c7..6c1afbe 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -5,6 +5,9 @@ from tap.formatter import format_as_diagnostics from tap.tracker import Tracker +SHOW_CAPTURE_LOG = ("log", "all") +SHOW_CAPTURE_OUT = ("system-out", "out-err", "all") +SHOW_CAPTUER_ERR = ("system-err", "out-err", "all") class TAPPlugin: def __init__(self, config: pytest.Config) -> None: @@ -185,18 +188,21 @@ def _make_as_diagnostics(report, tap_logging): """Format a report as TAP diagnostic output.""" lines = report.longreprtext.splitlines(keepends=True) - if tap_logging in ["log", "all"]: - lines[-1] += "\n" + if tap_logging in SHOW_CAPTURE_LOG: + if lines: + lines[-1] += "\n" lines += ["--- Captured Log ---\n"] + ( report.caplog.splitlines(keepends=True) or [""] ) - if tap_logging in ["system-out", "out-err", "all"]: - lines[-1] += "\n" + if tap_logging in SHOW_CAPTURE_OUT: + if lines: + lines[-1] += "\n" lines += ["--- Captured Out ---\n"] + ( report.capstdout.splitlines(keepends=True) or [""] ) - if tap_logging in ["system-err", "out-err", "all"]: - lines[-1] += "\n" + if tap_logging in SHOW_CAPTUER_ERR: + if lines: + lines[-1] += "\n" lines += ["--- Captured Err ---\n"] + ( report.capstderr.splitlines(keepends=True) or [""] ) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 88c3ce8..f6d9130 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -102,7 +102,8 @@ def test_logging(testdir, sample_test_file): def test_log_passing_tests(testdir, sample_test_file): """Test logs are added to TAP diagnostics.""" result = testdir.runpytest_subprocess( - "--tap", "--tap-logging", "log", "--tap-log-passing-tests" + "--tap", "--tap-logging", "log", + "--tap-log-passing-tests", "--log-level", "INFO" ) result.stdout.fnmatch_lines( [ From 31f714b0390756c2d4c1ef60ddabc2f6f2967007 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:42:16 +0000 Subject: [PATCH 12/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pytest_tap/plugin.py | 1 + tests/test_plugin.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index 6c1afbe..d0f2f15 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -9,6 +9,7 @@ SHOW_CAPTURE_OUT = ("system-out", "out-err", "all") SHOW_CAPTUER_ERR = ("system-err", "out-err", "all") + class TAPPlugin: def __init__(self, config: pytest.Config) -> None: self._tracker = Tracker( diff --git a/tests/test_plugin.py b/tests/test_plugin.py index f6d9130..635a6d6 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -102,8 +102,12 @@ def test_logging(testdir, sample_test_file): def test_log_passing_tests(testdir, sample_test_file): """Test logs are added to TAP diagnostics.""" result = testdir.runpytest_subprocess( - "--tap", "--tap-logging", "log", - "--tap-log-passing-tests", "--log-level", "INFO" + "--tap", + "--tap-logging", + "log", + "--tap-log-passing-tests", + "--log-level", + "INFO", ) result.stdout.fnmatch_lines( [ From 6d9857b339fc0686f8d46a13361468fdc6a75cdd Mon Sep 17 00:00:00 2001 From: Cody D'Ambrosio Date: Wed, 29 Jan 2025 09:57:13 -0500 Subject: [PATCH 13/14] use showcapture arg --- conftest.py | 1 + src/pytest_tap/plugin.py | 14 +++----------- tests/test_help.py | 2 +- tests/test_plugin.py | 6 ++++-- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/conftest.py b/conftest.py index fb63542..2fe0329 100644 --- a/conftest.py +++ b/conftest.py @@ -14,6 +14,7 @@ def sample_test_file(testdir): def test_ok(): LOGGER.info("Running test_ok") + LOGGER.debug("Debug logging info") assert True def test_not_ok(): diff --git a/src/pytest_tap/plugin.py b/src/pytest_tap/plugin.py index 6c1afbe..4ebe0e4 100644 --- a/src/pytest_tap/plugin.py +++ b/src/pytest_tap/plugin.py @@ -6,8 +6,8 @@ from tap.tracker import Tracker SHOW_CAPTURE_LOG = ("log", "all") -SHOW_CAPTURE_OUT = ("system-out", "out-err", "all") -SHOW_CAPTUER_ERR = ("system-err", "out-err", "all") +SHOW_CAPTURE_OUT = ("stdout", "all") +SHOW_CAPTUER_ERR = ("stderr", "all") class TAPPlugin: def __init__(self, config: pytest.Config) -> None: @@ -28,7 +28,7 @@ def __init__(self, config: pytest.Config) -> None: # Disable it automatically for streaming. self._tracker.header = False - self.tap_logging = config.option.tap_logging + self.tap_logging = config.option.showcapture self.tap_log_passing_tests = config.option.tap_log_passing_tests @pytest.hookimpl() @@ -152,14 +152,6 @@ def pytest_addoption(parser): "If the directory does not exist, it will be created." ), ) - group.addoption( - "--tap-logging", - default="no", - help=( - "Write captured log messages to TAP report: one of" - "no|log|system-out|system-err|out-err|all" - ), - ) group.addoption( "--tap-log-passing-tests", default=False, diff --git a/tests/test_help.py b/tests/test_help.py index 07ea834..543a11a 100644 --- a/tests/test_help.py +++ b/tests/test_help.py @@ -7,7 +7,7 @@ def test_includes_options(testdir): "*--tap-files*", "*--tap-combined*", "*--tap-outdir=path*", - "*--tap-logging*", + "*--tap-log-passing-tests*", ] result.stdout.fnmatch_lines(expected_option_flags) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index f6d9130..8e8128f 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -88,7 +88,7 @@ def test_outdir(testdir, sample_test_file): def test_logging(testdir, sample_test_file): """Test logs are added to TAP diagnostics.""" - result = testdir.runpytest_subprocess("--tap", "--tap-logging", "all") + result = testdir.runpytest_subprocess("--tap") result.stdout.fnmatch_lines( [ "# --- Captured Log ---", @@ -97,12 +97,13 @@ def test_logging(testdir, sample_test_file): "# --- Captured Err ---", ] ) + result.stdout.no_fnmatch_line("*Running test_ok*") def test_log_passing_tests(testdir, sample_test_file): """Test logs are added to TAP diagnostics.""" result = testdir.runpytest_subprocess( - "--tap", "--tap-logging", "log", + "--tap", "--tap-log-passing-tests", "--log-level", "INFO" ) result.stdout.fnmatch_lines( @@ -111,6 +112,7 @@ def test_log_passing_tests(testdir, sample_test_file): "*Running test_ok*", ] ) + result.stdout.no_fnmatch_line("*Debug logging info*") def test_xfail_no_reason(testdir): From 42301c7ebd64ed13b0771bac04df377e8f22e976 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 29 Jan 2025 14:57:51 +0000 Subject: [PATCH 14/14] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_plugin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 8e8128f..1c5b0ac 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -103,8 +103,7 @@ def test_logging(testdir, sample_test_file): def test_log_passing_tests(testdir, sample_test_file): """Test logs are added to TAP diagnostics.""" result = testdir.runpytest_subprocess( - "--tap", - "--tap-log-passing-tests", "--log-level", "INFO" + "--tap", "--tap-log-passing-tests", "--log-level", "INFO" ) result.stdout.fnmatch_lines( [