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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ If you find this helpful, please consider [sponsorship](https://github.com/spons
- Manage dependencies and virtual environments with [pdm](https://pdm-project.org/).
- Build with [setuptools](https://github.com/pypa/setuptools) and versioned with [setuptools-scm](https://github.com/pypa/setuptools_scm/).
- Lint with [pre-commit](https://pre-commit.com), [mypy](http://www.mypy-lang.org/), [ruff](https://github.com/charliermarsh/ruff), [toml-sort](https://github.com/pappasam/toml-sort) and [commitlint](https://commitlint.js.org/).
- Test with [pytest](https://pytest.org/) and [coverage](https://coverage.readthedocs.io) for threshold and reports.
- Test with [pytest](https://docs.pytest.org/) and [coverage](https://coverage.readthedocs.io) for threshold and reports.
- Documentation with [sphinx](https://www.sphinx-doc.org/), the [furo](https://pradyunsg.me/furo) theme and [MyST parser](https://myst-parser.readthedocs.io/) for markdown.
- Develop Command Line Interfaces with [typer](https://typer.tiangolo.com/).
- Manage configurations with [pydantic-settings](https://docs.pydantic.dev/latest/usage/pydantic_settings/).
Expand Down
1 change: 1 addition & 0 deletions docs/development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ git-workflow
setup-dev-env
cleanup-dev-env
commit
tests
```
27 changes: 27 additions & 0 deletions docs/development/tests.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Tests

In the context of CI/CD automation, dependency updates, and the release process, tests play a crucial role in daily development. We utilize [pytest](https://docs.pytest.org/) and [coverage](https://coverage.readthedocs.io) with proper configuration to ensure everything works as expected. This page provides general information and conventions we wish you to follow.

## Running Tests

After [setting up the development environment](/development/setup-dev-env.md), tests can be run with the command:

```bash
make test
```

With the default configuration, this command displays the result for each test case, the execution time for slow test cases, and a report on test coverage.

## Writing Tests

For guidelines on how to write tests, refer to [the official documentation](https://docs.pytest.org/how-to/assert.html). Here are some conventions we expect you to follow:

1. Organize all test cases under the `tests` directory.
2. Align test modules with the modules to be tested.

For example, tests for the `ss_python.cli` module should be located in the file `tests/cli_test.py`. If there are too many test cases, they can be split into files within the `tests/cli/` directory, using a prefix for each test file.
3. Unless necessary, do not lower the threshold of the test coverage.

## Coverage Report

After running the tests, the coverage report will be printed on the screen and generated as part of the documentation. You can view it [here](/reports/coverage/index.md).
2 changes: 1 addition & 1 deletion includes/sample.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ If you find this helpful, please consider [sponsorship](https://github.com/spons
- Manage dependencies and virtual environments with [pdm](https://pdm-project.org/).
- Build with [setuptools](https://github.com/pypa/setuptools) and versioned with [setuptools-scm](https://github.com/pypa/setuptools_scm/).
- Lint with [pre-commit](https://pre-commit.com), [mypy](http://www.mypy-lang.org/), [ruff](https://github.com/charliermarsh/ruff), [toml-sort](https://github.com/pappasam/toml-sort) and [commitlint](https://commitlint.js.org/).
- Test with [pytest](https://pytest.org/) and [coverage](https://coverage.readthedocs.io) for threshold and reports.
- Test with [pytest](https://docs.pytest.org/) and [coverage](https://coverage.readthedocs.io) for threshold and reports.
- Documentation with [sphinx](https://www.sphinx-doc.org/), the [furo](https://pradyunsg.me/furo) theme and [MyST parser](https://myst-parser.readthedocs.io/) for markdown.
- Develop Command Line Interfaces with [typer](https://typer.tiangolo.com/).
- Manage configurations with [pydantic-settings](https://docs.pydantic.dev/latest/usage/pydantic_settings/).
Expand Down
1 change: 1 addition & 0 deletions template/docs/development/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ git-workflow
setup-dev-env
cleanup-dev-env
commit
tests
```
27 changes: 27 additions & 0 deletions template/docs/development/tests.md.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Tests

In the context of CI/CD automation, dependency updates, and the release process, tests play a crucial role in daily development. We utilize [pytest](https://docs.pytest.org/) and [coverage](https://coverage.readthedocs.io) with proper configuration to ensure everything works as expected. This page provides general information and conventions we wish you to follow.

## Running Tests

After [setting up the development environment](/development/setup-dev-env.md), tests can be run with the command:

```bash
make test
```

With the default configuration, this command displays the result for each test case, the execution time for slow test cases, and a report on test coverage.

## Writing Tests

For guidelines on how to write tests, refer to [the official documentation](https://docs.pytest.org/how-to/assert.html). Here are some conventions we expect you to follow:

1. Organize all test cases under the `tests` directory.
2. Align test modules with the modules to be tested.

For example, tests for the `{{ module_name}}.cli` module should be located in the file `tests/cli_test.py`. If there are too many test cases, they can be split into files within the `tests/cli/` directory, using a prefix for each test file.
3. Unless necessary, do not lower the threshold of the test coverage.

## Coverage Report

After running the tests, the coverage report will be printed on the screen and generated as part of the documentation. You can view it [here](/reports/coverage/index.md).