Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.9", "3.10", "3.11", "3.12", "3.13"]
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
os: [ubuntu-latest, windows-latest]

steps:
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
UNRELEASED
----------

* Added official support for Python 3.12 and 3.13.
* Dropped support for EOL Python 3.7 and Python 3.8.
* `#90 <https://github.com/pytest-dev/pytest-reportlog/issues/90>`_: Fix jsonl output for pytest subtests (introduced in pytest 9.0).
* Added official support for Python 3.12, 3.13, and 3.14.
* Dropped support for EOL Python 3.7, 3.8, and 3.9.

0.4.0 (2023-05-22)
------------------
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ dynamic = ["version"]
description = "Replacement for the --resultlog option, focused in simplicity and extensibility"
readme = "README.rst"
license = "MIT"
requires-python = ">=3.9"
requires-python = ">=3.10"
authors = [
{ name = "Bruno Oliveira", email = "bruno@pytest.org" },
]
Expand All @@ -30,11 +30,11 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Software Development :: Testing",
]
dependencies = [
Expand Down
5 changes: 5 additions & 0 deletions src/pytest_reportlog/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ def pytest_runtest_logreport(self, report):
data = self._config.hook.pytest_report_to_serializable(
config=self._config, report=report
)

# Workaround for subtests that output `_report_type` instead of `$report_type` (#90).
if "_report_type" in data:
data["$report_type"] = data.pop("_report_type")

if (
self._config.option.report_log_exclude_logs_on_passed_tests
and data.get("outcome", "") == "passed"
Expand Down
18 changes: 18 additions & 0 deletions tests/test_reportlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,21 @@ def __str__(self):
bad = {"x": 1, "y": ["a", "b"], "c": C()}
new = cleanup_unserializable(bad)
assert new == {"x": 1, "c": "C instance", "y": ["a", "b"]}


def test_subtest(pytester, tmp_path):
"""Regression test for #90."""
pytester.makepyfile(
"""
def test_foo(subtests):
with subtests.test():
pass
"""
)
fn = tmp_path / "result.log"
result = pytester.runpytest(f"--report-log={fn}")
result.stdout.fnmatch_lines("*1 passed in*")
lines = fn.read_text("UTF-8").splitlines()
for line in lines:
data = json.loads(line)
assert "$report_type" in data