jeudi 2 novembre 2017

Pyenv and tox not work with multiple enviromnet

I want to test my app in 2 python versions. I install pyenv, so have multiple python in same system and can switch as I want.

I follow the answer in http://ift.tt/2zbc7nE

root@localhost:tmp root$ cat <<EOF >tox.ini
> [tox]
> envlist = py27, py35
> [testenv:py27]
> basepython = python2.7
> [testenv:py35]
> basepython = python3.5
> [testenv]
> commands = python --version
> EOF
root@localhost:tmp root$ cat <<EOF >setup.py
> from setuptools import setup
> setup(name="x")
> EOF

After creating both file, check, both versions are available.

root@localhost:tmp root$ pyenv rehash
root@localhost:tmp root$ pyenv versions
  system
* 3.5.2 (set by /Users/root/.pyenv/version)

Then ran the tox command.

root@localhost:tmp root$ tox
GLOB sdist-make: /private/tmp/setup.py
py27 inst-nodeps: /private/tmp/.tox/dist/x-0.0.0.zip
py27 installed: x==0.0.0
py27 runtests: PYTHONHASHSEED='2543352677'
py27 runtests: commands[0] | python --version
Python 2.7.10
py35 create: /private/tmp/.tox/py35
ERROR: InterpreterNotFound: python3.5
______________________________________________________________________________________ summary ______________________________________________________________________________________
  py27: commands succeeded
ERROR:   py35: InterpreterNotFound: python3.5

When I ran, pyenv versions it give me both version, but when run the tox command, it gives error for python 3.5 interpreter.

I am running this in MacOS.

Aucun commentaire:

Enregistrer un commentaire