Giter Club home page Giter Club logo

pytest-poo's Introduction

pytest-poo is a plugin for pytest that points out your crappy tests with piles of poo.

Really? Why?

I showed the --poo option at EuroPython 2013. A number of people thought I should release it, so here it is.

Screenshots

This is what the output usually looks like:

Normal mode, without poo

... when passing --poo, this is what is outputted instead:

Poo mode!

Requirements

A recent version of pytest is required (>= 2.3.4).

Quick start

  1. pip install pytest-poo
  2. Mark tests with the pytest.mark.poo marker.
  3. Run tests with the --poo option to enable pile of poo output.

Documentation

Marking tests

Add the pytest.mark.poo marker to the tests that you consider crappy. The markers are standard py.test markers and can be used like this on a test function:

import pytest

@pytest.mark.poo
def test_something():
    assert 0

or for classes:

import pytest

class MyTests(object):
    pytestmark = [pytest.mark.poo]

... or for entire modules:

import pytest

pytestmark = pytest.mark.poo


def test_a():
    assert 0


def test_b():
    assert 0

Showing crappy tests during test run

Just run py.test with the --poo option to enable the output. To always enable, add --poo to addopts in pytest.ini:

[pytest]
addopts = --poo

pytest-poo's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pytest-poo's Issues

Confusion around markers

Just curious about the reason for:

  1. Needing to mark tests for this to work
  2. Marking reporting tests with mark regardless of pass/fail status.

I know this was part of a talk or something that I missed.
My assumption about the --poo flag was that it would mark failures with ๐Ÿ’ฉ.
It was surprising to me that it was based on the poo marker instead.

I guess it's fine. Just wondering about the reason.

Would you be open to adding a ๐Ÿ™‚ or something for passing poo marked tests?
Or maybe dropping markers and just ๐Ÿ’ฉ-ing all failed tests?

incompatible with current pytest

get lots of error messages.
...
INTERNALERROR> if pytest.config.option.poo and report.failed:
INTERNALERROR> AttributeError: module 'pytest' has no attribute 'config'

Might not be too hard to fix. But I haven't tried yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.