微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

FileNotFound 错误为什么在 azure 上使用 testenv py38 运行 tox

如何解决FileNotFound 错误为什么在 azure 上使用 testenv py38 运行 tox

我有一个使用 azure yaml 管道部署的 Python 代码库。我们正在尝试从 python 3.6 迁移到 3.8。当我尝试在 py38 testenv 中运行 tox 时,出现一个奇怪的错误

       cwd: C:\a\4\s\pip-req-build-5_140xzf
  Complete output (8 lines):
  Traceback (most recent call last):
    File "C:\a\4\s\.tox\py38\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 280,in <module>
      main()
    File "C:\a\4\s\.tox\py38\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 259,in main
      hook_input = read_json(pjoin(control_dir,'input.json'))
    File "C:\a\4\s\.tox\py38\lib\site-packages\pip\_vendor\pep517\_in_process.py",line 38,in read_json
      with open(path,'r',encoding='utf-8') as f:
  FileNotFoundError: [Errno 2] No such file or directory: '.\\tmpirazvq1d\\input.json'
  ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\a\4\s\.tox\py38\Scripts\python.EXE' 'C:\a\4\s\.tox\py38\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel '.\tmpirazvq1d' Check the logs for full command output.
WARNING: You are using pip version 20.2.3; however,version 21.1.2 is available.
You should consider upgrading via the 'C:\a\4\s\.tox\py38\Scripts\python.EXE -m pip install --upgrade pip' command.

我已经升级了 pip,但我猜测 testenv 会下载并使用自己的 pip 并覆盖我的。这些是产生此错误的管道任务:

- powershell: |
    write-host "Upgrade pip";
    python -m pip install --upgrade pip --no-cache-dir;

    write-host "Install tox";
    pip install tox tox-venv --upgrade --no-cache-dir;
  displayName: 'Install tox'

- powershell: |
    python -m pip install --upgrade pip;
    write-host "Running tox with --recreate argument.";
    tox -r;
  displayName: 'Run tox' 

这是我的 tox.ini 文件的相关部分:

; TOX SETTINGS
; Only affect runs started via tox -r,locally or via build

; Which tox environments to set up
[tox]
envlist = py38,bandit,black,Flake8,safety
isolated_build = True

[testenv:py38]
deps =
    pytest
    pytest-cov
    pytest-env
    pytest-mock
    fakeredis
commands =
    pytest {posargs} -m "not external_service_required" --junitxml=junit_coverage.xml --cov-report=html --cov-report=xml:coverage.xml

这是我的 pyproject.toml 文件的相关部分:

[tool.poetry.dependencies]
python = ">=3.8,<3.9"
Cython = "0.29.23"
Paste = "2.0.3"
azure-identity = "1.0.1"
azure-storage-blob = "12.0.0"
celery = "3.1.25"
click = "7.1.2"
eventlet = "0.23.0"
fakeredis = "1.2.1"
Flake8 = "3.8.3"
flask-restplus = "0.12.1"
flask = "1.0.2"
flower = "0.9.2"
msal = "1.0.0"
numpy = "1.18.1"
openpyxl = "3.0.5"
opnieuw = "0.0.3"
pandas = "0.25.2"
pyodbc = "4.0.30"
python-decouple = "3.1"
pythonnet = "2.5.2"
pytz = "2018.4"
redis = "2.10.6"
requests = "2.22.0"
sqlalchemy = "1.3.5"
tornado = "5.1"
tox = "3.7"
vine = "1.1.4"
werkzeug = "0.16.1"
cryptography = "3.4.7"
importlib-Metadata = "3.7.3"

[tool.poetry.dev-dependencies]
black = "^20.8b1"
coverage = "4.5.2"
pytest = "6.2.4"
pytest-cover = "3.0.0"
pytest-mock = "3.6.1"

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

有没有人处理过这个问题,或者谁能指出我正确的方向?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。