https://github.com/56kyle/pytest-static
A Pytest plugin that helps automate testing of code that mimics statically typed design patterns.
https://github.com/56kyle/pytest-static
pypi-package pytest pytest-fixtures pytest-plugin python
Last synced: 11 months ago
JSON representation
A Pytest plugin that helps automate testing of code that mimics statically typed design patterns.
- Host: GitHub
- URL: https://github.com/56kyle/pytest-static
- Owner: 56kyle
- License: mit
- Created: 2023-05-06T22:04:10.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-06-16T12:02:45.000Z (12 months ago)
- Last Synced: 2025-07-05T07:50:09.789Z (11 months ago)
- Topics: pypi-package, pytest, pytest-fixtures, pytest-plugin, python
- Language: Python
- Homepage: https://github.com/56kyle/pytest-static
- Size: 830 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# pytest-static
[][pypi status]
[][pypi status]
[][pypi status]
[][license]
[][read the docs]
[][tests]
[][codecov]
[][pre-commit]
[][black]
[pypi status]: https://pypi.org/project/pytest-static/
[read the docs]: https://pytest-static.readthedocs.io/
[tests]: https://github.com/56kyle/pytest-static/actions?workflow=Tests
[codecov]: https://app.codecov.io/gh/56kyle/pytest-static
[pre-commit]: https://github.com/pre-commit/pre-commit
[black]: https://github.com/psf/black
## Overview
pytest-static is a pytest plugin that allows you to parametrize your tests using type annotations.
What this looks like in practice is that you can write a test like this:
```python
import pytest
@pytest.mark.parametrize_types("a", [tuple[bool, bool]])
def test_a(a: bool) -> None:
assert isinstance(a, bool)
```
Which would be equivalent to the following test
```python
import pytest
@pytest.mark.parametrize("a", [(True, True), (True, False), (False, True), (False, False)])
def test_a(a: int) -> None:
assert isinstance(a, int)
```
For types such as int, str, etc that have an unlimited amount of values, there are premade sets meant to cover common edge cases that are used by default
These premade sets can be modified or added to using the type_handlers.register decorator, or the type_handlers.clear function.
## Features
- TODO
## Requirements
- TODO
## Installation
You can install _pytest-static_ via [pip] from [PyPI]:
```console
$ pip install pytest-static
```
## Usage
Please see the [Command-line Reference] for details.
## Contributing
Contributions are very welcome.
To learn more, see the [Contributor Guide].
## License
Distributed under the terms of the [MIT license][license],
_pytest-static_ is free and open source software.
## Issues
If you encounter any problems,
please [file an issue] along with a detailed description.
## Credits
This project was generated from [@cjolowicz]'s [Hypermodern Python Cookiecutter] template.
[@cjolowicz]: https://github.com/cjolowicz
[pypi]: https://pypi.org/
[hypermodern python cookiecutter]: https://github.com/cjolowicz/cookiecutter-hypermodern-python
[file an issue]: https://github.com/56kyle/pytest-static/issues
[pip]: https://pip.pypa.io/
[license]: https://github.com/56kyle/pytest-static/blob/main/LICENSE
[contributor guide]: https://github.com/56kyle/pytest-static/blob/main/CONTRIBUTING.md
[command-line reference]: https://pytest-static.readthedocs.io/en/latest/usage.html