Skip to content

A Pytest plugin that helps automate testing of code that mimics statically typed design patterns.

License

Notifications You must be signed in to change notification settings

56kyle/pytest-static

Repository files navigation

pytest-static

PyPI Status Python Version License

Read the documentation at https://pytest-static.readthedocs.io/ Tests Codecov

pre-commit 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:

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

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:

$ 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, 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.

About

A Pytest plugin that helps automate testing of code that mimics statically typed design patterns.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published