Skip to main content

pytest-spec

pytest plugin to display test execution output like a SPECIFICATION.

Available features

  • Format output to look like specification.

  • Group tests by classes.

  • Failed, passed and skipped are marked and colored.

  • Remove test_ and underscores for every test.

  • Method under test may be highlighted (method) like in example.

Output example

py.test --spec

test/test_example.py::TestWhenExamplePassed
    [PASS]  Execute returns positive return code

test/test_example.py::TestWhenExampleFailed
    [FAIL]  Execute returns negative return code

test/test_example.py::TestWhenExampleIsSkipped
    [SKIP]  Execute returns something

test/test_example.py::TestExamplesWhenMethodUnderTestIsHighlighted
    [FAIL]  The (execute_command) returns negative return code
    [PASS]  The (execute_command) returns positive return code
    [SKIP]  The (execute_command) returns something

Highlight method under test

Simple test definition is required (double ‘__’ characters before and after method) to put method under test between ‘<>’ characters e.g.

def test__execute_method__returns_something(self):

may be displayed as:

[PASS]  The (execute_command) returns something
[FAIL]  The (execute_command) returns something
[SKIP]  The (execute_command) returns something

This type of format provides clear information:

  • which method is under test

  • what kind of result should be expected

Continues Integration

https://drone.io/github.com/pchomik/pytest-spec/status.png

Download

Latest version of plugin is available in drone.io project artifacts.

Install

pip install pytest-spec

Contribution

Please feel free to present your idea by code example (pull request) or reported issues.

Future plans

  • Tests with other pytest plugins to check possible side-effects.

  • Work to make output even better.

License

pytest-spec - pytest plugin to display test execution output like a SPECIFICATION.

Copyright (C) 2014 Pawel Chomicki

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 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-spec-0.2.24.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file pytest-spec-0.2.24.tar.gz.

File metadata

  • Download URL: pytest-spec-0.2.24.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pytest-spec-0.2.24.tar.gz
Algorithm Hash digest
SHA256 0b09f7d41d08e6d055d87b362bcb6e53bd3c663ff27c111debf288a954b1bf82
MD5 7f18f782541be5c0199cfe0d72437fa5
BLAKE2b-256 33c6a6ac5f7bbb669a9cc44ff809dbb0ee692930b6d010d03410bbbc7ba6935e

See more details on using hashes here.

Release history Release notifications | RSS feed

6.1.0

2 files

6.0.0

2 files

5.2.0

2 files

5.1.0

2 files

5.0.0

2 files

4.0.0

2 files

3.2.0

2 files

3.1.0

2 files

3.0.6

2 files

3.0.5

2 files

3.0.4

2 files

3.0.1

2 files

3.0.0

2 files

2.0.0

2 files

1.1.0

1 file

1.0.1

1 file

1.0.0

2 files

This release

0.2.24 This release

1 file

0.2.23

1 file

0.2.22

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page