9

Here is my tox.ini file:

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

When I run tox<Enter> it kicks off pytest for each of the three environments specified. When pytest first starts (for each environment) it reports the versions of Python and a few other things that it is using. For example, for py36 I see:

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     ==============

It says py36 runtests: ... and then it says platform linux -- Python 3.6.7, ... so all is good.

Similarly, I see

py37 runtests: PYTHONHASHSEED='893013612'
py37 runtests: commands[0] | pytest
======================== test session starts ==================
platform linux -- Python 3.7.4, ...

All good again.


The problem is, when it comes to py38 I see:

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 ====================

Why am I seeing Python 3.6.7 for py38 ??? Am I doing something wrong here?

Many thanks, in advance, for your help!


For what it's worth, here is my general environment information, running 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

5
  • 1
    Do you have Python 3.8 installed? AFAIK, it is not installed by default on 18.04 (which would not explain the fallback to 3.6, though). Commented Mar 16, 2020 at 17:58
  • I was thinking that may be the issue; So are you saying that tox won't install any Python version into its virtual environments that is higher than the system Python version (but it willl install those that are less)?? Commented Mar 16, 2020 at 18:03
  • 1
    It may not know how to install them - try to install 3.8 manually and test again. Note that this is only a guess based on some previous (not recent) experience with tox. Commented Mar 16, 2020 at 18:05
  • 1
    I tried installing Python 3.8 (using apt-get) but that created problems (tox failed to create a py38 environment at all). I suspect the problems were because my Python version 3.7 is packaged with Anaconda. So I apt removed the 3.8 and instead used conda to create a 3.8 conda environment; then activated it. When I did that, tox worked fine for 3.6, 3.7, and 3.8. Thanks!! Commented Mar 16, 2020 at 19:07
  • Ah, ok, that explains it! Commented Mar 16, 2020 at 19:08

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.