Open ods opened 4 years ago
this is probably the same fault that is reported in #222 . I have just started using pytest-sugar and when I pytest with any combination of the -r flag, I get output three times...
import pytest
class Test:
@pytest.fixture()
def setUp(self):
print("setup")
yield "resource"
print("teardown")
def test_that_depends_on_resource(self, setUp):
print("testing {}".format(setUp))
and I get:
pytest tests/ -rA
(Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or hide this info with --headless.)
Test session starts (platform: linux, Python 3.10.5, pytest 7.1.2, pytest-sugar 0.9.5)
Using --randomly-seed=1102316951
rootdir: /var/home/XXX/src/test_tests/django_test
plugins: ordering-0.6, metadata-2.0.2, forked-1.4.0, html-2.0.1, rerunfailures-10.2, randomly-3.12.0, mock-3.8.2, django-4.5.2, cov-3.0.0, bdd-6.0.1, xdist-2.5.0, seleniumbase-3.5.11, sugar-0.9.5
collecting ...
tests/features/test_test.py ✓ 100% ██████████
==================================== PASSES ====================================
______________________ Test.test_that_depends_on_resource ______________________
---------------------------- Captured stdout setup -----------------------------
setup
______________________ Test.test_that_depends_on_resource ______________________
---------------------------- Captured stdout setup -----------------------------
setup
----------------------------- Captured stdout call -----------------------------
testing resource
______________________ Test.test_that_depends_on_resource ______________________
---------------------------- Captured stdout setup -----------------------------
setup
----------------------------- Captured stdout call -----------------------------
testing resource
--------------------------- Captured stdout teardown ---------------------------
teardown
=========================== short test summary info ============================
PASSED tests/features/test_test.py::Test::test_that_depends_on_resource
PASSED tests/features/test_test.py::Test::test_that_depends_on_resource
PASSED tests/features/test_test.py::Test::test_that_depends_on_resource
Results (0.03s):
1 passed
and
pytest tests/ -rA -p no:sugar
(Linux uses --headless by default. To override, use --headed / --gui. For Xvfb mode instead, use --xvfb. Or hide this info with --headless.)
============================= test session starts ==============================
platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
Using --randomly-seed=4284594808
rootdir: /var/home/XXX/src/test_tests/django_test
plugins: ordering-0.6, metadata-2.0.2, forked-1.4.0, html-2.0.1, rerunfailures-10.2, randomly-3.12.0, mock-3.8.2, django-4.5.2, cov-3.0.0, bdd-6.0.1, xdist-2.5.0, seleniumbase-3.5.11
collected 1 item
tests/features/test_test.py . [100%]
==================================== PASSES ====================================
______________________ Test.test_that_depends_on_resource ______________________
---------------------------- Captured stdout setup -----------------------------
setup
----------------------------- Captured stdout call -----------------------------
testing resource
--------------------------- Captured stdout teardown ---------------------------
teardown
=========================== short test summary info ============================
PASSED tests/features/test_test.py::Test::test_that_depends_on_resource
============================== 1 passed in 0.03s ===============================
.... :(
I'm not seeing this issue with the following:
python 3.11.2 pytest==7.4.4 pytest-sugar==0.9.7
Test file
Output with pytest-sugar
Output with pytest-sugar