简体   繁体   中英

Pytest in Azure pipeline does not see specific files?

I have a src directory which contains a pyproject.toml , right next to my setup.py (which I can find, for a fact).

But when I run the task

- bash: pytest -c src/pyproject.toml
  displayName: Run tests
  workingDirectory: $(Pipeline.Workspace)

I get FileNotFoundError: [Errno 2] No such file or directory: '/home/vsts/work/1/src/pyproject.toml' .

Everything works fine without trying to point to this file from pytest. Why? The same setup works fine locally.

The workingDirectory should be $(System.DefaultWorkingDirectory) , not $(Pipeline.Workspace) .

The $(Pipeline.Workspace) is the local path on the agent where all folders for a given build pipeline are created .

The $(System.DefaultWorkingDirectory) is the local path on the agent where your source code files are downloaded .

Click this document for detailed information about predefined variables in Azure DevOps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM