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.

Files for pytest-pigeonhole, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size pytest_pigeonhole-0.2-py3-none-any.whl (3.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size pytest-pigeonhole-0.2.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page