DEV Community

SalvaVamsiKasyap
SalvaVamsiKasyap

Posted on

Pytest is not recognizing test_ files when running through jenkin declarative pipeline

I am trying to execute the pytest files from jenkins declarative pipeline so when i give pytest command through pipeline the test files are not being picked up by pytest but when i run the same in my local it is working any help on this would be appreciated.

Directory of C:\Users\Lenovo.jenkins\workspace\Jenkins_DeclarativePipeline

05/07/2023 02:17 PM

.
05/07/2023 01:35 PM ..
05/07/2023 01:39 PM .pytest_cache
05/07/2023 02:17 PM 787 Jenkinsfile
05/07/2023 02:03 PM 1,266 pytest_output.txt
05/07/2023 02:06 PM 1,266 pytest_output_1.txt
05/07/2023 02:16 PM 674 requirements.txt
05/07/2023 01:39 PM 907 test_orangehrm.py
05/07/2023 01:35 PM 27 vamsi.py
05/07/2023 01:39 PM pycache
6 File(s) 4,927 bytes
4 Dir(s) 155,479,240,704 bytes free

C:\Users\Lenovo.jenkins\workspace\Jenkins_DeclarativePipeline>pytest test_orangehrm.py
============================= test session starts =============================
platform win32 -- Python 3.10.5, pytest-7.2.0, pluggy-1.0.0
rootdir: C:\Users\Lenovo.jenkins\workspace\Jenkins_DeclarativePipeline
plugins: html-3.2.0, metadata-2.0.4
collected 0 items

I have the pytest file in the directory but it is not recognized and picked up by pytest

It is supposed to execute the pytest files i.e test_orangehrm.py in this case.

Top comments (0)