{"id":21013408,"url":"https://github.com/heavenshell/py-autodoc","last_synced_at":"2025-05-15T04:34:17.130Z","repository":{"id":13531890,"uuid":"16223342","full_name":"heavenshell/py-autodoc","owner":"heavenshell","description":"Autodoc Python implementation.","archived":false,"fork":false,"pushed_at":"2023-05-23T02:03:41.000Z","size":77,"stargazers_count":7,"open_issues_count":5,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-19T13:45:58.725Z","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/heavenshell.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.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":"2014-01-25T02:45:47.000Z","updated_at":"2021-09-11T13:39:53.000Z","dependencies_parsed_at":"2024-06-19T13:43:22.694Z","dependency_job_id":null,"html_url":"https://github.com/heavenshell/py-autodoc","commit_stats":{"total_commits":111,"total_committers":3,"mean_commits":37.0,"dds":0.3153153153153153,"last_synced_commit":"a31c36bb19da26931424ee7e118daae5543352b0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heavenshell%2Fpy-autodoc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heavenshell%2Fpy-autodoc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heavenshell%2Fpy-autodoc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heavenshell%2Fpy-autodoc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heavenshell","download_url":"https://codeload.github.com/heavenshell/py-autodoc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225328910,"owners_count":17457325,"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-11-19T09:42:17.940Z","updated_at":"2024-11-19T09:42:18.434Z","avatar_url":"https://github.com/heavenshell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Autodoc\n=======\nGenerate documentation from your unit-test.\n\n.. image:: https://travis-ci.org/heavenshell/py-autodoc.png?branch=master\n\nThis library is Python implementation of Autodoc.\n\n- `Autodoc \u003chttps://github.com/r7kamura/autodoc\u003e`_\n- `Test::JsonAPI::Autodoc \u003chttps://metacpan.org/pod/Test::JsonAPI::Autodoc\u003e`_\n\nLinks\n-----\n\n- `Repository \u003chttps://github.com/heavenshell/py-autodoc\u003e`_\n- `Documentation \u003chttp://autodoc.readthedocs.org/en/latest/\u003e`_\n\n\nInstallation\n------------\n\n::\n\n  $ virtualenv --distribute autodoc_sample\n  $ source autodoc/bin/activate\n  $ cd autodoc\n  $ pip install autodoc\n\n\nUsage\n-----\nRun unittest with PYAUTODOC=1 to generate documents for your tests decorated with `@autodoc.generate`.\n\n::\n\n  PYAUTODOC=1 python -m unittest examples/test_unittest.py\n\nIf you use py.test as test runner.\n\n::\n\n  PYAUTODOC=1 py.test tests examples/test_pytest.py\n\nIf you use nose as test runner.\n\n::\n\n  PYAUTODOC=1 nosetests tests examples/test_unittest.py\n\nExample for unittest\n--------------------\n::\n\n  class TestUnittest(TestCase):\n      def setUp(self):\n          app = create_app\n          self.client = TestApp(app)\n\n      @classmethod\n      @autodoc.generate('var/test_unittest.rst')\n      def tearDownClass(cls):\n          pass\n\n      @autodoc.describe('GET /')\n      def test_get(self):\n          \"\"\" GET / \"\"\"\n          res = self.client.get('/')\n          self.assertEqual(res.status_code, 200)\n\n          return res\n\n\n`@autodoc.describe()` describe test name.\n\nFor example `GET /` assigned to generated document.\n\n`@autodoc.generate(path_to_output)` will generate document.\n\n\nExample for py.test\n-------------------\n::\n\n  @pytest.fixture\n  def setup():\n      setup = TestApp(create_app)\n\n      return setup\n\n\n  @autodoc.generate('var/test_pytest.md', template='templates/markdown.md')\n  def teardown_module(module):\n      pass\n\n\n  @autodoc.describe('POST /')\n  def test_post(setup):\n      res = setup.post_json('/', params={'id': 1, 'message': 'foo'})\n      assert res.status_code == 200\n\n      return res\n\n\nExample for requests\n--------------------\n::\n\n  import requests\n\n  class TestUnittest(TestCase):\n    def setUp(self):\n      self.client = requests\n\n    @classmethod\n    @autodoc.generate('var/test_unittest.rst')\n    def tearDownClass(cls):\n      pass\n\n    @autodoc.describe('POST /')\n    def test_post(self):\n      \"\"\" POST / \"\"\"\n      params = {'id': 1, 'message': 'foo'}\n      headers = {'content-type': 'application/json'}\n      res = self.client.post('http://example.com/',\n                             data=params, headers=headers)\n      self.assertEqual(res.status_code, 200)\n\n      return res\n\n\nConventions\n-----------\n\nReturn WebTest or requests response in test method\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nPy-Autodoc must return WebTest response.\n\n::\n\n  @autodoc.describe('POST /')\n  def test_post(setup):\n      res = setup.post_json('/', params={'id': 1, 'message': 'foo'})\n      assert res.status_code == 200\n\n      return res # Must return WebTest or requests response.\n\n\n\nGenerate document point\n~~~~~~~~~~~~~~~~~~~~~~~\n\n`@autodoc.generate` will create document.\n\nIf you set `@autodoc.generate` to each test case, document will generate each file.\n\n::\n\n  class TestUnittest(TestCase):\n      def setUp(self):\n          app = create_app\n          self.client = TestApp(app)\n\n      @autodoc.generate('var/indext_get.rst')\n      @autodoc.describe('GET /')\n      def test_get(self):\n          \"\"\" GET / \"\"\"\n          res = self.client.get('/')\n          self.assertEqual(res.status_code, 200)\n\n          return res\n\n      @autodoc.generate('var/foo_get.rst')\n      @autodoc.describe('GET /foo')\n      def test_get(self):\n          \"\"\" GET / \"\"\"\n          res = self.client.get('/foo')\n          self.assertEqual(res.status_code, 200)\n\n          return res\n\nThis will generate `var/index_get.rst` and `var/foo_get.rst`.\n\nIf you want to generate all tests into single file,\ndecorate `@autodoc.generate` to `tearDownClass`, `teardown_module` fixture.\n\n\nConfiguration\n-------------\nYou can configure `@autodoc.generat(output, template=path_to_template)` to change template file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheavenshell%2Fpy-autodoc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheavenshell%2Fpy-autodoc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheavenshell%2Fpy-autodoc/lists"}