Skip to main content

No project description provided

Project description

pytest-pigeonhole is a pytest plugin that adds a terminal-summary in whose outcomes are splitted along given fixture value.

Usage

Install the plugin and then add –pigeonhole given_fixture_name parameter to your pytest run. That’s all.

Alternativelly you can either add such to your conftest.py:

from pigeonhole.plugin import configure_pigeonhole

def pytest_configure(config):
    configure_pigeonhole(config, "given_fixture_name")

Or such statement to pytest.ini or tox.ini:

[pytest] addopts = –pigeonhole given_fixture_name

Each of above gives the same result.

Usage example:

  • conftest.py:

    import pytest
    from pigeonhole.plugin import configure_pigeonhole
    
    def pytest_configure(config):
        configure_pigeonhole(config, "that_fixture")
    
    @pytest.fixture(params=["one", "two", 23, False])
    def that_fixture(request):
        return request.param
    
    @pytest.fixture(params=range(3))
    def int_fixture(request):
        return request.param
  • test_usage.py:

    import pytest
    
    @pytest.fixture
    def faulty_setup(that_fixture):
        assert not that_fixture
    
    def test_passes(that_fixture):
        pass
    
    def test_int_passes(int_fixture):
        if not int_fixture:
            pytest.skip()
    
    def test_fail(that_fixture, int_fixture):
        assert int_fixture
    
    def test_errors(faulty_setup):
        pass
  • calling pytest adds terminal-report (without additional commandline arguments):

    ============= Pigeonhole: that_fixture =========
    'one' | p: 3    | f: 1    | s: 0    | e: 1
    'two' | p: 3    | f: 1    | s: 0    | e: 1
    23    | p: 3    | f: 1    | s: 0    | e: 1
    False | p: 4    | f: 1    | s: 0    | e: 0
    N/A   | p: 2    | f: 0    | s: 1    | e: 0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-pigeonhole-0.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

pytest_pigeonhole-0.2-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page