I am trying to create a python azure function CI pipeline build. In the yml file, after installing the dependencies (pytest exists in requirements.txt), it cannot find pytest module. I cannot seem to figure what the issue is. What am I missing?
- task: UsePythonVersion@0
displayName: Use Python 3.11
inputs:
versionSpec: 3.11
- task: Bash@3
displayName: Install Application Dependencies
inputs:
targetType: inline
script: >-
python -m pip install --upgrade pip
pip install --target="$(System.DefaultWorkingDirectory)/.python_packages/lib/site-packages" -r requirements.txt
- script: pytest . --verbose
Azure DevOps fails on pytest step where it says pytest can't be found.
requirements.txt
pytest~=8.1.1
What I've tried:
- Adding --target (as you can see)
- Adding target: host to pytest script
- venv (which worked but I do not want to use venv)
I tried adding
pytestmodule in my requirements.txt and ran the Azure Devops yaml pipeline below, The Function and the package got deployed successfully.My Azure Devops pipeline:-
My requirements.txt:-
Output:-