https://pantsbuild.org/ logo
#general
Title
# general
f

fresh-cat-90827

10/04/2021, 1:51 PM
hey team. I am wondering how Pants deal with
pytest
skipping the tests when they are selected with markers?
Running this command and having a single test decorated with
@pytest.mark.integration
(defined in the
projectA
directory):
Copy code
$ ./pants test :: --pytest-args='-m "integration"'

✓ projectA/tests/test_module.py:../projectA_tests succeeded.
𐄂 projectB/tests/test_module.py:../tests failed.
𐄂 projectC/tests/test_module.py:../tests failed.

$ echo $?
5
The pytest docs say:
pytest now exits with status code 5 in situations where no tests were run at all, such as the directory given in the command line does not contain any tests or as result of a command line option filters all out all tests
This makes sense and I find this to be reasonable. However, users may find it slightly confusing to see the red crosses with the
"failed"
status in the Pants output. Do you think we should instead have some other status such as
"skipped"
- I assume this happens because Pants thinks that
pytest
commands returning any other code than 0 have failed.
👍 1
a

astonishing-london-2419

10/04/2021, 2:03 PM
I asked a similar question, this thread may be of use -> https://pantsbuild.slack.com/archives/C046T6T9U/p1630331953075000
f

fresh-cat-90827

10/04/2021, 2:05 PM
thanks @astonishing-london-2419 that’s perfect
would still love the thoughts of others on having those test modules reporting
failed
despite not having any tests run…
c

curved-television-6568

10/04/2021, 2:21 PM
I think it would make sense to present pytest exit code 5 as skipped in the UI.. https://docs.pytest.org/en/latest/reference/exit-codes.html
5 Views