I want to turn off output in pytest console

Question:

I want to turn off output in Pytest console, so i can see only my logs
I tried pytest -x -s -tb=no but its not exactly what i want
I want to get rid of this output
======================================================== test session starts ========================================================= platform win32 -- Python 3.10.7, pytest-7.2.0, pluggy-1.0.0 rootdir: C:Users...projectsautotest-lksource collected 6 items

Any advices?

Asked By: Maksik

||

Answers:

You can use the -q or --quiet option in Pytest to suppress the header and summary output, while still allowing your test logs to be displayed. Here is an example command:

pytest -q

Alternatively, you can use the -r or --report option to customize the output that is displayed. For example, you can use -rN to only show the test names and status, like this:

pytest -rN

You can also combine the -q and -r options to suppress the header and summary output, while still showing the test names and status:

pytest -q -rN
Answered By: Mats Nilsen
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.