pytest collects and passes tests locally, but 'collected 0 items' in GitHub Actions workflow (exit code 5)

330 Views Asked by At

I'm new to GitHub Actions workflows and encountering an issue with pytest. Locally, my tests are successfully collected and pass without any problems. However, when running the same tests in a GitHub Actions workflow, pytest fails to recognize any tests and displays the error "collected 0 items" with exit code 5.

I have followed the pytest naming conventions by naming the test file, the test class, and the test function appropriately:

File name: test_example.py

Class name: TestExample

Function name: test_example

For running the test, I use the following command:

pytest --doctest-modules --durations=10 --pyargs <package name>

To provide more context, I've created a simple repository where you can find the code: github

Any insights or suggestions on how to resolve this issue would be greatly appreciated. I'm happy to provide more information if needed.

1

There are 1 best solutions below

0
On

Ok, so the issue was resolved by removing the usage of pyargs from the pytest command..