Jenkins setup is on Ubuntu.
Local: Created a virtual environment using python 3.6, running tests through command line using pythom -m pytest - ./{test.py} which is successful
Jenkins job:
In the Build > Shell script, creating a virtual environment the same way done locally and running the commands.
python3.6 -m venv jenkins-venv
source ${WORKSPACE}/jenkins-venv/bin/activate 
pip install --no-cache-dir -r ${WORKSPACE}/project/requirements.txt
python -m pytest -v ${WORKSPACE}/project/test_day1.py 
Error:
 ERROR collecting scripts/
ImportError while importing test module '/var/lib/jenkins/workspace/job_name/project/test_Login.py'.
Hint: make sure your test modules/packages have valid Python names.
ModuleNotFoundError: No module named
This happens if your PATH variable includes that module's directory on your machine but not on Jenkins.
Python tests run locally on ubuntu but fails when run through Jenkins with error "ImportError while importing test module '/var/lib/jenkins/workspace"