Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,37 @@ Then you will see something like this:
To get ruff automatically running install the following Plugin:
- [VSCode - Ruff Plugin](https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff)

### Continuous Delivery

## Testing

A test suite of a typical Python package consists of unit, integration, and documentation tests
(i.e. the code snippets embedded in the documentation).
It is important to write tests to ensure that your code works as intended.

This template provides a minimal setup for testing. Tests can be executed by invoking Pytest:

```shell
pytest
```

The runner looks for tests in `src` and `tests` folders. On top of that, the Python code
in the top-level `README.md` file is also executed.
If `README.md` shows a snippet like this:

```python
>>> from project_name.foo import foo
>>> foo()
True

```
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way you phrased it, it sounds like the code snipped is imporant. However, I think what you actually wanted to make is an example on how to write a doctest, right?

So, maybe:

Suggested change
```
the most imporant functionality. For example snippets like these will be executed by pytest:
```python
>>> from project_name.foo import foo
>>> foo()
True


Pytest will execute the snippet to ensure that invoking `foo()` in fact returns `True`.

The snippets in `README.md` can document the typical use cases of the package.
Since the snippets are executed, any code changes that render the documentation obsolete will be picked up, forcing a documentation update.


## Continuous Delivery
You've done it, your package is at a state, where you want other to use it. Luckily, this repository features a CD-Pipeline,
that will build and upload your packages to Pypi for you. To get the CD running you need to first follow these [instructions](https://docs.pypi.org/trusted-publishers/adding-a-publisher/). The pipeline uses [OIDC](https://openid.net/developers/how-connect-works/) to authenticate on Pypi. Make sure your [pyproject.toml](pyproject.toml) is set up correctly, which means take care of 2. of the section **Basic Setup**.

Expand Down
4 changes: 2 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[pytest]
minversion = 7.0
pythonpath = src
testpaths =
tests
testpaths = src tests README.md
addopts = --doctest-modules --doctest-glob README.md