{"id":15675043,"url":"https://github.com/boxed/pytest-readme","last_synced_at":"2025-05-06T22:14:29.801Z","repository":{"id":25096989,"uuid":"28518034","full_name":"boxed/pytest-readme","owner":"boxed","description":"Make sure your README doesn't contain broken code","archived":false,"fork":false,"pushed_at":"2022-09-02T06:28:27.000Z","size":4,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-06T22:14:18.778Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boxed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-26T18:26:37.000Z","updated_at":"2024-07-24T13:13:03.000Z","dependencies_parsed_at":"2022-07-24T04:16:12.946Z","dependency_job_id":null,"html_url":"https://github.com/boxed/pytest-readme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fpytest-readme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fpytest-readme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fpytest-readme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boxed%2Fpytest-readme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boxed","download_url":"https://codeload.github.com/boxed/pytest-readme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252776600,"owners_count":21802469,"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":[],"created_at":"2024-10-03T15:55:17.988Z","updated_at":"2025-05-06T22:14:28.666Z","avatar_url":"https://github.com/boxed.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"pytest-readme\n=============\n\nA pytest plugin to pull out tests from your README.md into pytest automatically. This will make it easy to make sure your readme doesn't contain any errors.\n\nUsage\n=====\n\nFirst `pip install pytest-readme`, then create a `conftest.py` file in the same directory as your README.md and put the following two lines in it:\n\n```python\n\nfrom pytest_readme import setup\nsetup()\n```\n\npytest-readme will generate a file called `test_readme.py`, so you probably want to add that to your `.gitignore` file. \n\npytest-readme supports two formats of tests: \n* doctest style\n* pytest style\n\nNote also that any blocks of python code without asserts is treated as pytest style test, so the code will be executed in a test. This is useful for at least checking that the functions exists, the parameters are in the correct order and that exceptions aren't raised.\n\nDoctest style:\n\nYou will need to add the `doctest-modules` flag to your test runs. I recommend creating a pytest.ini file and having the following contents in it to make this automatic: \n\n```\n[pytest]\naddopts = --doctest-modules\n```\n\nExample:\n\n```python\n\u003e\u003e\u003e 1 + 1\n2\n```\n\nPytest style example:\n\n```python\nassert 1 + 1 == 2\n```\n\nTo avoid running a block of code from your readme, just make sure you have an empty line first. This won't show in in the markdown render and pytest-readme will skip the block.\n\nBadge\n=====\n\nYou can show that your README is tested with this badge: [![Examples tested with pytest-readme](http://img.shields.io/badge/readme-tested-brightgreen.svg)](https://github.com/boxed/pytest-readme) Copy paste the markdown syntax below:\n\n    [![Examples tested with pytest-readme](http://img.shields.io/badge/readme-tested-brightgreen.svg)](https://github.com/boxed/pytest-readme)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxed%2Fpytest-readme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboxed%2Fpytest-readme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboxed%2Fpytest-readme/lists"}