{"id":18063418,"url":"https://github.com/yuvalino/pytest-publish","last_synced_at":"2025-04-05T13:25:09.395Z","repository":{"id":241468117,"uuid":"805871423","full_name":"yuvalino/pytest-publish","owner":"yuvalino","description":"Live publishing of pytest test results to REST API","archived":false,"fork":false,"pushed_at":"2024-06-04T07:17:55.000Z","size":51,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-11T08:48:24.644Z","etag":null,"topics":["pytest","pytest-plugin","python","python3","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yuvalino.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-25T17:47:26.000Z","updated_at":"2024-06-04T07:17:58.000Z","dependencies_parsed_at":"2024-06-04T08:36:19.740Z","dependency_job_id":null,"html_url":"https://github.com/yuvalino/pytest-publish","commit_stats":null,"previous_names":["yuvalino/pytest-publish"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvalino%2Fpytest-publish","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvalino%2Fpytest-publish/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvalino%2Fpytest-publish/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvalino%2Fpytest-publish/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuvalino","download_url":"https://codeload.github.com/yuvalino/pytest-publish/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247340773,"owners_count":20923317,"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","python","python3","rest-api"],"created_at":"2024-10-31T05:11:11.844Z","updated_at":"2025-04-05T13:25:09.375Z","avatar_url":"https://github.com/yuvalino.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pytest-publish\n\npytest-publish is a simple pytest plugin for publishing test results mid-session.\n\nUseful for live applications running on top of pytest (UI, logstash, etc).\n\n## Usage\n\nThere are 2 switches which can be turned on, each run every time a test has finished running:\n\n1. `--publish \u003curl\u003e` to publish JSON reports to REST API.\n2. `--pubdir \u003cpath\u003e` to write results to filesystem.\n\n\n### --publish\n\nRun test like this:\n```sh\n$ pytest --publish http://localhost:7777/test-update\n```\n\nOn each test result, an HTTP POST request with the following JSON data will be submitted:\n```python\n# from pytest_publish.py\n@dataclass_json\n@dataclass\nclass TestResult:\n    @dataclass_json\n    @dataclass\n    class ExcInfo:\n        type: str\n        value: str\n        traceback: list[str]\n\n    type: str\n    result: str  # \"pass\", \"skip\", \"fail\"\n    nodeid: str\n    start_time: float\n    stop_time: float\n    duration: float\n    stdout: str\n    stderr: str\n    log: str\n    xdist_dist: str | None  # only with xdist\n    xdist_worker: str | None  # only with xdist\n    xdist_scope: str | None  # only with xdist\n    excinfo: ExcInfo | None = None  # only if \"skip\" or \"fail\"\n\n```\n\n### --pubdir\n\nRun test like this:\n```sh\n$ pytest --pubdir /tmp/a\n```\n\nOn each test result, the following directory tree will be created:\n```sh\n/tmp/a\n/tmp/a/test_a\n/tmp/a/test_a/.lock\n/tmp/a/test_a/count\n/tmp/a/test_a/0.pass               # \u003cindex\u003e.\u003cresult\u003e \n/tmp/a/test_a/0.pass/brief.txt     # textual description of result \n/tmp/a/test_a/0.pass/result.json   # same data as --publish\n/tmp/a/test_a/0.pass/exception.txt # only if \"skip\" or \"fail\"\n/tmp/a/test_a/0.pass/stdout.txt    # only if any stdout\n/tmp/a/test_a/0.pass/stderr.txt    # only if any stderr\n/tmp/a/test_a/0.pass/log.txt       # only if any logs\n```\n\n**NOTE:** If xdist's `--dist loadgroup` is run with xdist, the directory tree will look like this:\n```sh\n/tmp/a/\u003cscope\u003e\n/tmp/a/\u003cscope\u003e/\u003ctest_name\u003e\n/tmp/a/\u003cscope\u003e/\u003ctest_name\u003e/count\n```\nNotice the addition of the `\u003cscope\u003e` to the directory tree above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuvalino%2Fpytest-publish","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuvalino%2Fpytest-publish","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuvalino%2Fpytest-publish/lists"}