Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
stas00 opened this issue Apr 5, 2021 · 4 comments
Closed

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

stas00 opened this issue Apr 5, 2021 · 4 comments

Comments

@stas00
Copy link

stas00 commented Apr 5, 2021

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 stas00 changed the title invalid reports when used with -rA invalid reports when used with -rA, repeats 3 times with instafail Apr 5, 2021
@Teemu
Copy link
Owner

Teemu commented Nov 5, 2022

Hey 👋, pytest-sugar is actually a fork of pytest-instafail so you probably don't want both of them to be installed.

@Teemu Teemu closed this as completed Nov 5, 2022
@stas00
Copy link
Author

stas00 commented Nov 11, 2022

Thank you for the explanation of the problem, @Teemu

Should pytest-sugar print a warning or assert if both are detected - how would other users know that they must not use the 2 together?

@Teemu
Copy link
Owner

Teemu commented Nov 12, 2022 via email

@stas00
Copy link
Author

stas00 commented Nov 14, 2022

Thank you, @Teemu

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants