{"id":13501524,"url":"https://github.com/pytest-dev/pytest-reportlog","last_synced_at":"2025-03-29T09:30:40.496Z","repository":{"id":36227091,"uuid":"221779731","full_name":"pytest-dev/pytest-reportlog","owner":"pytest-dev","description":"Replacement for the --resultlog option, focused in simplicity and extensibility","archived":false,"fork":false,"pushed_at":"2025-02-11T11:15:40.000Z","size":78,"stargazers_count":95,"open_issues_count":5,"forks_count":19,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-03-17T11:02:54.452Z","etag":null,"topics":["pytest","pytest-plugin","testing"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pytest-dev.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-14T20:19:35.000Z","updated_at":"2025-03-10T18:28:17.000Z","dependencies_parsed_at":"2023-11-27T22:30:56.632Z","dependency_job_id":"6a545939-56b1-4244-b3de-cf5dac1785b9","html_url":"https://github.com/pytest-dev/pytest-reportlog","commit_stats":{"total_commits":53,"total_committers":11,"mean_commits":4.818181818181818,"dds":0.5660377358490566,"last_synced_commit":"0be1066a2e442995577bec3cc6d5184ac3b4c6fd"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-reportlog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-reportlog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-reportlog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pytest-dev%2Fpytest-reportlog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pytest-dev","download_url":"https://codeload.github.com/pytest-dev/pytest-reportlog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246166988,"owners_count":20734377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pytest","pytest-plugin","testing"],"created_at":"2024-07-31T22:01:40.490Z","updated_at":"2025-03-29T09:30:40.168Z","avatar_url":"https://github.com/pytest-dev.png","language":"Python","funding_links":[],"categories":["Python","Plugins"],"sub_categories":[],"readme":"================\npytest-reportlog\n================\n\n|python| |version| |anaconda| |ci| |black|\n\n.. |version| image:: http://img.shields.io/pypi/v/pytest-reportlog.svg\n  :target: https://pypi.python.org/pypi/pytest-reportlog\n\n.. |anaconda| image:: https://img.shields.io/conda/vn/conda-forge/pytest-reportlog.svg\n    :target: https://anaconda.org/conda-forge/pytest-reportlog\n\n.. |ci| image:: https://github.com/pytest-dev/pytest-reportlog/workflows/test/badge.svg\n  :target: https://github.com/pytest-dev/pytest-reportlog/actions\n\n.. |python| image:: https://img.shields.io/pypi/pyversions/pytest-reportlog.svg\n  :target: https://pypi.python.org/pypi/pytest-reportlog/\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n  :target: https://github.com/ambv/black\n\nReplacement for the ``--resultlog`` option, focused in simplicity and extensibility.\n\n.. note::\n    This plugin was created so developers can try out the candidate to replace the\n    `deprecated --resultlog \u003chttps://docs.pytest.org/en/latest/deprecations.html#result-log-result-log\u003e`__ option.\n\n    If you use ``--resultlog``, please try out ``--report-log`` and provide feedback.\n\nUsage\n=====\n\nInstall ``pytest-reportlog`` as a test requirement in your test environment.\n\nThe ``--report-log=FILE`` option writes a file in `JSON lines \u003chttps://jsonlines.org/\u003e`__ format as the test session executes.\n\nEach line of the report log contains a self contained JSON object corresponding to a testing event,\nsuch as a collection or a test result report. The file is guaranteed to be flushed after writing\neach line, so systems can read and process events in real-time.\n\nEach JSON object contains a special key ``$report_type``, which contains a unique identifier for\nthat kind of report object. For future compatibility, consumers of the file should ignore reports\nthey don't recognize, as well as ignore unknown properties/keys in JSON objects that they do know,\nas future pytest versions might enrich the objects with more properties/keys.\n\nCompression\n===========\n\nCommon compression suffixes like `.gz`, `.bz2` and `.xz` will automatically use the requested compression format.\nThe implementations from the python stdlib are used and must be enabled in the python builds.\n\nExample\n-------\n\nConsider this file:\n\n.. code-block:: python\n\n    # content of test_report_example.py\n\n\n    def test_ok():\n        assert 5 + 5 == 10\n\n\n    def test_fail():\n        assert 4 + 4 == 1\n\n\n::\n\n    $ pytest test_report_example.py -q --report-log=log.jsonl\n    .F                                                                   [100%]\n    ================================= FAILURES =================================\n    ________________________________ test_fail _________________________________\n\n        def test_fail():\n    \u003e       assert 4 + 4 == 1\n    E       assert (4 + 4) == 1\n\n    test_report_example.py:8: AssertionError\n    ------------------- generated report log file: log.jsonl --------------------\n    1 failed, 1 passed in 0.12s\n\nThe generated ``log.jsonl`` will contain a JSON object per line:\n\n::\n\n    $ cat log.jsonl\n    {\"pytest_version\": \"5.2.2\", \"$report_type\": \"SessionStart\"}\n    {\"nodeid\": \"\", \"outcome\": \"passed\", \"longrepr\": null, \"result\": null, \"sections\": [], \"$report_type\": \"CollectReport\"}\n    {\"nodeid\": \"test_report_example.py\", \"outcome\": \"passed\", \"longrepr\": null, \"result\": null, \"sections\": [], \"$report_type\": \"CollectReport\"}\n    {\"nodeid\": \"test_report_example.py::test_ok\", \"location\": [\"test_report_example.py\", 0, \"test_ok\"], \"keywords\": {\"test_ok\": 1, \"pytest-reportlog\": 1, \"test_report_example.py\": 1}, \"outcome\": \"passed\", \"longrepr\": null, \"when\": \"setup\", \"user_properties\": [], \"sections\": [], \"duration\": 0.0, \"$report_type\": \"TestReport\"}\n    {\"nodeid\": \"test_report_example.py::test_ok\", \"location\": [\"test_report_example.py\", 0, \"test_ok\"], \"keywords\": {\"test_ok\": 1, \"pytest-reportlog\": 1, \"test_report_example.py\": 1}, \"outcome\": \"passed\", \"longrepr\": null, \"when\": \"call\", \"user_properties\": [], \"sections\": [], \"duration\": 0.0, \"$report_type\": \"TestReport\"}\n    {\"nodeid\": \"test_report_example.py::test_ok\", \"location\": [\"test_report_example.py\", 0, \"test_ok\"], \"keywords\": {\"test_ok\": 1, \"pytest-reportlog\": 1, \"test_report_example.py\": 1}, \"outcome\": \"passed\", \"longrepr\": null, \"when\": \"teardown\", \"user_properties\": [], \"sections\": [], \"duration\": 0.00099945068359375, \"$report_type\": \"TestReport\"}\n    {\"nodeid\": \"test_report_example.py::test_fail\", \"location\": [\"test_report_example.py\", 4, \"test_fail\"], \"keywords\": {\"test_fail\": 1, \"pytest-reportlog\": 1, \"test_report_example.py\": 1}, \"outcome\": \"passed\", \"longrepr\": null, \"when\": \"setup\", \"user_properties\": [], \"sections\": [], \"duration\": 0.0, \"$report_type\": \"TestReport\"}\n    {\"nodeid\": \"test_report_example.py::test_fail\", \"location\": [\"test_report_example.py\", 4, \"test_fail\"], \"keywords\": {\"test_fail\": 1, \"pytest-reportlog\": 1, \"test_report_example.py\": 1}, \"outcome\": \"failed\", \"longrepr\": {\"reprcrash\": {\"path\": \"D:\\\\projects\\\\pytest-reportlog\\\\test_report_example.py\", \"lineno\": 6, \"message\": \"assert (4 + 4) == 1\"}, \"reprtraceback\": {\"reprentries\": [{\"type\": \"ReprEntry\", \"data\": {\"lines\": [\"    def test_fail():\", \"\u003e       assert 4 + 4 == 1\", \"E       assert (4 + 4) == 1\"], \"reprfuncargs\": {\"args\": []}, \"reprlocals\": null, \"reprfileloc\": {\"path\": \"test_report_example.py\", \"lineno\": 6, \"message\": \"AssertionError\"}, \"style\": \"long\"}}], \"extraline\": null, \"style\": \"long\"}, \"sections\": [], \"chain\": [[{\"reprentries\": [{\"type\": \"ReprEntry\", \"data\": {\"lines\": [\"    def test_fail():\", \"\u003e       assert 4 + 4 == 1\", \"E       assert (4 + 4) == 1\"], \"reprfuncargs\": {\"args\": []}, \"reprlocals\": null, \"reprfileloc\": {\"path\": \"test_report_example.py\", \"lineno\": 6, \"message\": \"AssertionError\"}, \"style\": \"long\"}}], \"extraline\": null, \"style\": \"long\"}, {\"path\": \"D:\\\\projects\\\\pytest-reportlog\\\\test_report_example.py\", \"lineno\": 6, \"message\": \"assert (4 + 4) == 1\"}, null]]}, \"when\": \"call\", \"user_properties\": [], \"sections\": [], \"duration\": 0.0009992122650146484, \"$report_type\": \"TestReport\"}\n    {\"nodeid\": \"test_report_example.py::test_fail\", \"location\": [\"test_report_example.py\", 4, \"test_fail\"], \"keywords\": {\"test_fail\": 1, \"pytest-reportlog\": 1, \"test_report_example.py\": 1}, \"outcome\": \"passed\", \"longrepr\": null, \"when\": \"teardown\", \"user_properties\": [], \"sections\": [], \"duration\": 0.0, \"$report_type\": \"TestReport\"}\n    {\"exitstatus\": 1, \"$report_type\": \"SessionFinish\"}\n\n\nrecord_property\n---------------\n\nThe ``record_property`` fixture allows to log additional information for a test, just like with JUnitXML format.\nConsider this test file:\n\n.. code-block:: python\n\n    def test_function(record_property):\n        record_property(\"price\", 12.34)\n        record_property(\"fruit\", \"banana\")\n        assert True\n\nThis information will be recorded in the report JSON objects under the ``user_properties`` key as follows::\n\n    ..., \"user_properties\": [[\"price\", 12.34], [\"fruit\", \"banana\"]], ...\n\nNote that this nested list construct is just the JSON representation\nof a list of tuples (name-value pairs).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytest-dev%2Fpytest-reportlog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpytest-dev%2Fpytest-reportlog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpytest-dev%2Fpytest-reportlog/lists"}