Skip to main content

Generate mermaid / markdown sequence diagrams from your tests

Project description

docs-from-tests

This python package contains functions to instrument your code / tests to create sequence diagrams (in markdown / mermaid) as the tests run.

The sequence diagrams show the runtime call hierachy of the code. They are saved as files in the repository, which you should check in.

You can choose to ignore specific functions, and private functions, to make diagrams readable in each context you are interested in.

The diagrams are useful documentation, and will stay up to date as they are automatically generated. Hopefully it will encourage us to have useful diagrams in the repo, with the appropriate levels of detail, which in turn will encourage us to structure the code well so it produces good diagrams, and to have tests at these levels of detail.

You can see an example of this package in use at docs-from-tests-example.

Build Status

Build status

Usage

You can see an example of instrumenting a test at tests\test_hello_world.py

This test creates the following diagram

The diagram is reproduced here for convenience. It is a mermaid diagram, you may need to install a Browser Plugin or VsCode extension or similar to view it.

View full screen as SVG

sequenceDiagram
  start->>HelloWorldCombiner.combine: calls x1
  HelloWorldCombiner.combine->>hello: calls x1
  hello-->>HelloWorldCombiner.combine: returns str
  HelloWorldCombiner.combine->>world: calls x1
  world-->>HelloWorldCombiner.combine: returns str
  HelloWorldCombiner.combine-->>start: returns str

Running tests

  • use python>=3.7
  • pip install requirements.txt
  • set pythonpath=<path to root of this repo>
  • pytest

Contributing

  • Use PEP-0008
  • Please open up an Issue for new work, where any discussion can take place, and then submit a pull request to fix the issue.

Project Champion

The champion for this a repo is Cedd Burge who is accountable for:

  • The usability of the repo, and ensuring user guides and READMEs are up to date
  • The code quality of the repo (CODEOWNERS, pull requests, tests, and builds all help here)
  • The usability of the code for other developers (retrospectives, code quality, architecture, and documentation all help here)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docs_from_tests-0.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

docs_from_tests-0.0.2-py2-none-any.whl (5.0 kB view details)

Uploaded Python 2

File details

Details for the file docs_from_tests-0.0.2.tar.gz.

File metadata

  • Download URL: docs_from_tests-0.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.17

File hashes

Hashes for docs_from_tests-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4e5a26c522f1a03238c52d0f884a695addb9da19e8399ec6518ec3ec9ed5ea29
MD5 f4da1f827ce29a21498f1925eb0f7c1e
BLAKE2b-256 265b10499e5fa0768055e0f36438469be677fd0f90128731be0047c8584e5a2e

See more details on using hashes here.

File details

Details for the file docs_from_tests-0.0.2-py2-none-any.whl.

File metadata

  • Download URL: docs_from_tests-0.0.2-py2-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.17

File hashes

Hashes for docs_from_tests-0.0.2-py2-none-any.whl
Algorithm Hash digest
SHA256 36a643160f55c3a1a1d6058290ca26420c55ace4789fefde44c9802c611100c2
MD5 9e4db0f0a269dc6a9661d70e26102391
BLAKE2b-256 b982076dd897681bdb25d4955cc2052e27f5d2a722482060c551ca52453b9c4c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page