What does the "-rN" segment of this code do pytest.main(["-v", "–tb=line", "-rN", __file__])?

Question:

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.

Asked By: Joseph

||

Answers:

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 except pP
  • A – all
  • N – 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.

Answered By: Michael Delgado
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.