Skip to content

Add Python Doctests #5795

@luxedo

Description

@luxedo

In the current main branch we have 32 python code blocks in guide and 17 in src:

rg '```python' guide/ | wc -l
32
rg '```python' src/ | wc -l
17

As the project grows, it might become increasingly hard to check if those blocks are correct and up to date.

Adding python doctest or similar to nox and the CI can guarantee the scalability. With those checks, some categories of issues like #3639 would not exist.

Requirements

  • Have a way to skip tests (+SKIP, no_run)
  • Being able to run in .md, .py and .rs files
  • Hide any setup/teardown code in rendered documentation
  • Don't burden the CI 🤖

Some examples have two code blocks, one for the code and the other for the output. We may need to change them to adhere to doctest syntax or write our own plugin to check their validity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions