I have just started learning pytest and was told to use the following code to launch pytest but given no explanation about what everything did.
[pytest.main(\["-v", "--tb=line", "-rN", __file__\])][1]
Between Google and the pytest website (https://docs.pytest.org/) I have figured out everything else, I just cannot find what the "-rN" segment does. When I run the test without that segment in the code, it seems to not have any difference. Can anyone provide any insights and hopefully some documentation I can study as well?
Test result with full code segment.
Test result with without the code segment in question
pytest.main(["-v", "--tb=line", __file__])
Test Result without the code segment in question.
The only difference that I can find is that it runs faster without the code segment in question.
CodePudding user response:
from the command line reference:
-r chars show extra test summary info as specified by chars: (f)ailed, (E)rror, (s)kipped, (x)failed, (X)passed, (p)assed, (P)assed with output, (a)ll except passed (p/P), or (A)ll. (w)arnings are enabled by default (see --disable-warnings), 'N' can be used to reset the list. (default: 'fE').
Also see this page on Managing pytest's output:
Special characters for (de)selection of groups:
a
- all exceptpP
A
- allN
- none, this can be used to display nothing (since fE is the default)
so the flag -rN
overrides defaults and any settings in a config file and explicitly tells pytest not to display any output.