4

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?

Andry
  • 339
  • 7
  • 23

2 Answers2

12

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

kosist
  • 2,868
  • 2
  • 17
  • 30
  • 1
    Thanks! Seems like I had missed this "little" fact. Changed test names and everything works fine now! =) – Andry Oct 06 '18 at 11:09
0

Something I tried to do to figure this out was to run pytest --collect-only <directory_where_tests_are> and it told me what the issue was.

In my case the issue was that the test module required libraries that weren't installed, so pytest skips those files/directories.

Hope this helps!

Reza S
  • 9,480
  • 3
  • 54
  • 84