Skip to main content

A python test spec based on pytest

Project description

The pySpec plugin transforms the pytest output into RSpec.

Just nest your tests using classes and include docstring for each class and test. You can create any nested levels.

The following test sample:

import pytest

class TestHouse:
    "a House"
    
    def test_door(self):
        "has door"
        assert 1 == 1
        
    class TestTwoFloors:
        """with two floors
        
        A house with two floor has stairs
        """
        def test_stairs(self):
            "has stairs"
            assert 1 == 1

        def test_second_floor(self):
            "has second floor"
            assert 1 == 1

        def test_third_floor(self):
            "has third floor"
            assert 1 == 2

Generates the following output:

test/test_sample.py 

A house
  ✓ Has door

A house
  With two floors
    ✓ Has stairs
    ✓ Has second floor
    ✗ Has third floor

Installing and running pySpec

pip install pytest-pyspec
pytest --pyspec

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_pyspec-0.4.2.tar.gz (15.8 kB view hashes)

Uploaded Source

Built Distribution

pytest_pyspec-0.4.2-py3-none-any.whl (16.5 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