0

Been searching on this one for a while and been surprised to not find much. I'm currently working away with pytest and looking to improve the detail on passed tests.

The aim here is to report the individual tests that passed alongside the failures with the same level of detail. Using the example from the site for a failed test:

$ pytest
======= test session starts ========
platform linux -- Python 3.5.2, pytest-3.0.4, py-1.4.31, pluggy-0.4.0
rootdir: $REGENDOC_TMPDIR, inifile:
collected 1 items

test_sample.py F

======= FAILURES ========
_______ test_answer ________

def test_answer():
    >       assert func(3) == 5
    E       assert 4 == 5
    E        +  where 4 = func(3)

test_sample.py:5: AssertionError
======= 1 failed in 0.12 seconds ========

I'm looking for a way for the passed tests to be reported in a similar manor, possibly with custom text?

If not a way to add custom text to the end report would suffice.

Is this possible or am I trying something here that's not correct?

Cheers, R.

Ryuzagi
  • 1
  • 2

1 Answers1

1

py.test -s shows stdout of successful tests.

This is not like fail result in the example above, but in successful pass you do not have any asserts fired.

So you would see just what your test will output to stdout in successful pass.

ANDgineer
  • 505
  • 3
  • 12
  • Later I found the same answer on stackoverflow http://stackoverflow.com/questions/24617397/how-to-print-to-console-in-py-test – ANDgineer Nov 16 '16 at 09:20