pytest-sugar icon indicating copy to clipboard operation
pytest-sugar copied to clipboard

invalid reports when used with `-rA`, repeats 3 times with instafail

Open stas00 opened this issue 4 years ago • 0 comments

pytest-sugar reports strange things when used with -rA

Command used to run pytest

pytest test_example.py

Test file

def test_example():
    print(1)
    pass

Output

Test session starts (platform: linux, Python 3.8.5, pytest 6.2.2, pytest-sugar 0.9.4)
rootdir: /home/stas/hf/transformers-stas
plugins: forked-1.3.0, xdist-2.2.0, sugar-0.9.4, instafail-0.4.2
collecting ...
 test_example.py ✓                                                                                                                    100% ██████████

Results (0.02s):
       1 passed

with -rA

$ pytest -rA test_example.py
Test session starts (platform: linux, Python 3.8.5, pytest 6.2.2, pytest-sugar 0.9.4)
rootdir: /home/stas/hf/transformers-stas
plugins: forked-1.3.0, xdist-2.2.0, sugar-0.9.4, instafail-0.4.2
collecting ...
 test_example.py ✓                                                                                                                    100% ██████████
====================================================================== PASSES =======================================================================
___________________________________________________________________ test_example ____________________________________________________________________
--------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------
1
___________________________________________________________________ test_example ____________________________________________________________________
--------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------
1
============================================================== short test summary info ==============================================================
PASSED test_example.py::test_example
PASSED test_example.py::test_example
PASSED test_example.py::test_example

Results (0.02s):
       1 passed

2 problems:

  1. stdout is dumped twice
  2. PASSED report is printed trice

If combined with instafail

It now also reports the test 3 times! ✓✓✓

pytest -rA test_example.py --instafail
====================================================================== test session starts =======================================================================
platform linux -- Python 3.8.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/stas/hf/transformers-stas
plugins: forked-1.3.0, xdist-2.2.0, sugar-0.9.4, instafail-0.4.2
collected 1 item

test_example.py ✓✓✓                                                                                                                                                            [100%]

============================================================================= PASSES =============================================================================
__________________________________________________________________________ test_example __________________________________________________________________________
---------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------
1
__________________________________________________________________________ test_example __________________________________________________________________________
---------------------------------------------------------------------- Captured stdout call ----------------------------------------------------------------------
1
==================================================================== short test summary info =====================================================================
PASSED test_example.py::test_example
PASSED test_example.py::test_example
PASSED test_example.py::test_example
======================================================================= 3 passed in 0.06s ========================================================================

W/o -rA

pytest test_example.py --instafail
====================================================================== test session starts =======================================================================
platform linux -- Python 3.8.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/stas/hf/transformers-stas
plugins: forked-1.3.0, xdist-2.2.0, sugar-0.9.4, instafail-0.4.2
collected 1 item

test_example.py ✓✓✓                                                                                                                                                            [100%]

======================================================================= 3 passed in 0.01s ========================================================================

Thanks.

stas00 avatar Apr 05 '21 01:04 stas00