Search code examples
pythonautomated-testspytestgitlab-ci

Pytest not selecting all tests from directory


I'm trying to set up a continious integration for my GitLab project for the first time and I am struggling to get the 'test' stage working. Right now I have my test subfolder and 2 almost identical tests in it that should pass.

As I understand running the command pytest will run pytest on all test files it finds in current directory. The problem is only 1st problem is executing instead of all.

Here is the picture of the result from pipeline:

enter image description here

As you can see from the listing there are 2 files, but only the first one is tested.

What could have I missed here?


Solution

  • Filenames should start or end with "test" word. Your second file name does not keep this requirement, so that's why pytest can't find it. You could check also this link