pytest - tox 运行错误的 Python 版本
问题描述
这是我的 tox.ini 文件:
dino@DINO:~/code/mplfinance$ cat tox.ini
[tox]
envlist = py36, py37, py38
[pytest]
python_files = tests.py
[testenv]
deps =
matplotlib
numpy
pandas
pytest
setenv =
# don't use interactive backend for matplotlib in e2e tests
MPLBACKEND = agg
commands =
pytest
当我运行tox<Enter>
它时,它会为指定的三个环境中的每一个启动 pytest。当 pytest 首次启动时(对于每个环境),它会报告 Python 的版本和它正在使用的其他一些东西。例如,py36
我看到:
py36 runtests: PYTHONHASHSEED='893013612'
py36 runtests: commands[0] | pytest
============= test session starts ==============
platform linux -- Python 3.6.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/dino/code/mplfinance, inifile: tox.ini
collected 2 items
tests.py .. [100%]
=========== 2 passed in 13.48s ==============
它说py36 runtests: ...
,然后它说platform linux -- Python 3.6.7, ...
一切都很好。
同样,我看到
py37 runtests: PYTHONHASHSEED='893013612'
py37 runtests: commands[0] | pytest
======================== test session starts ==================
platform linux -- Python 3.7.4, ...
一切都好。
问题是,当谈到 py38 时,我看到:
py38 runtests: PYTHONHASHSEED='893013612'
py38 runtests: commands[0] | pytest
============ test session starts ==================
platform linux -- Python 3.6.7, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
rootdir: /home/dino/code/mplfinance, inifile: tox.ini
collected 2 items
tests.py .. [100%]
============== 2 passed in 16.19s ====================
为什么我看到Python 3.6.7
???py38
我在这里做错了吗?
非常感谢您的帮助!
对于它的价值,这是我运行 WSL 的一般环境信息:
dino@DINO:~/code/mplfinance$ cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.2 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
dino@DINO:~/code/mplfinance$ uname -a
Linux DINO 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 x86_64 x86_64 GNU/Linux
dino@DINO:~/code/mplfinance$ python --version
Python 3.7.4
解决方案
推荐阅读
- java - JAssert 库未包含在 Spring Boot 测试中
- visual-studio - 通过名称访问 GameObject 并在 unity3d 中执行 setActive(false) 操作
- ios - Swift 中的函数调用问题
- math - n个弱分类器组合的准确率限制
- ios - 如何从 Admin SDK 创建 Firebase 动态链接
- android - 在新活动而不是当前活动中触发画中画
- proof - 下面证明 NP hard 或 P 方程
- json - bash shell 脚本从文件中由双引号分隔的特定行获取子字符串
- java - Spring JPA @Converter - 如何使用自己的 id 作为盐来加密实体?
- azure-devops - 在 Azure DevOps 发布定义中从同一个项目部署多个 WebJobs?