Questions tagged [tox]

tox is a generic virtualenv management and test running tool.

tox is a generic virtualenv management and test command line tool you can use for:

  • checking your package installs correctly with different Python versions and interpreters running your tests in each of the environments,
  • configuring your test tool of choice
  • acting as a frontend to Continuous Integration servers, greatly reducing boilerplate and merging CI and shell-based testing

Resources:

529 questions
11
votes
2 answers

"ERROR: py37: InterpreterNotFound: python3.7" when running tox from github

I have a project on GitHub with a tox.ini file: [tox] envlist = py3 [testenv] deps = -rrequirements.txt commands = pytest --doctest-modules It works well. But when I replace "py3" with "py37", it fails with the error: ERROR: py37:…
Erel Segal-Halevi
  • 33,955
  • 36
  • 114
  • 183
11
votes
1 answer

Reporting cumulative coverage across multiple Python versions

I have code that runs conditionally depending on the current version of Python, because I'm supporting 2.6, 2.7, and 3.3 from the same package. I currently generate a coverage report like this, using the default version of Python: coverage run…
coffee-grinder
  • 26,940
  • 19
  • 56
  • 82
10
votes
4 answers

How to clean a tox environment after running?

I have the following tox.ini file: [tox] envlist = flake8,py{35,36,37,38}{,-keyring} [testenv] usedevelop = True install_command = pip install -U {opts} {packages} deps = .[test] keyring: .[keyring] setenv = COVERAGE_FILE =…
vvvvv
  • 25,404
  • 19
  • 49
  • 81
10
votes
3 answers

tox tests, use setup.py extra_require as tox deps source

I want to use setup.py as the authority on packages to install for testing, done with extra_requires like so: setup( # ... extras_require={ 'test': ['pytest', ], }, ) Tox only appears to be capable of installing from a…
ThorSummoner
  • 16,657
  • 15
  • 135
  • 147
10
votes
1 answer

Use wildcard in tox command

For different reasons I have to do pip install as a command in my tox.ini (I do skipsdist=True so tox will not install my dependencies for me, but I still need some of them installed into the virtual environment). The problem is that I have a local…
Daniel Larsson
  • 6,278
  • 5
  • 44
  • 82
10
votes
2 answers

tox uses wrong version of pip when multiple versions of python are installed

I have a build box which supports python 2.4, 2.6 and 2.7. This leads to installing various versions of pips as required in their own python installations. I'm using tox to run tests through setup.py. Whenever I run a…
opensourcegeek
  • 5,552
  • 7
  • 43
  • 64
9
votes
0 answers

tox running wrong Python version

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…
Daniel Goldfarb
  • 6,937
  • 5
  • 29
  • 61
9
votes
1 answer

Python/tox Install a dependency as editable

In tox.ini, you specify the packages that you want tox to install in the virtualenvs it creates. [testenv] deps = mock pytest commands = python setup.py test -q python setup.py flake8 This example tells tox to install mock and…
Christian Long
  • 10,385
  • 6
  • 60
  • 58
9
votes
1 answer

Running Django test with setup.py test and tox

I built a Django app and made a package out of it with setuptools. Now, I would like to do the following things: I would like to run all tests with python setup.py test. But when I issue this command, I…
linkyndy
  • 17,038
  • 20
  • 114
  • 194
8
votes
0 answers

Tox discarding pythonpath, good idea to explicitely reset it?

In my virtualenv activation, I like to set export PYTHONPATH= so that I can run scripts directly. Now when I run tox from within the virtualenv, I get the following warning in alarming red color: WARNING: Discarding $PYTHONPATH from…
Janos
  • 796
  • 1
  • 9
  • 26
8
votes
2 answers

How to test ansible roles?

Scenario I want to develop ansible roles. Those roles should be validated through a CI/CD process with molecule and utilize docker as driver. This validation step should include multiple Linux flavours (e.g. centos/ubuntu/debian) times the supported…
ckaserer
  • 4,827
  • 3
  • 18
  • 33
8
votes
1 answer

Is it possible to point tox to pull a dependency from a branch (aka use `pip -e` behind the scenes)?

How to test on py27 and py37 in tox when the py37 changes aren't packaged to pypi The py3.7 compatible changes exist in repo branches. They can be run by hand through pip -e installing them and running pytest without tox. I'd like to move to…
SwimBikeRun
  • 4,192
  • 11
  • 49
  • 85
8
votes
2 answers

Tox can't copy non-python file while installing the module

This is the tree structure of the module I'm writing the setup.py file for: ls . LICENSE README.md bin examples module scratch setup.py tests tox.ini I configured my setup.py as follows: from setuptools import setup, find_packages setup( …
rdbisme
  • 850
  • 1
  • 13
  • 39
8
votes
2 answers

Coverage in tox for multiple python versions

Here is a link to a project and output that you can use to reproduce the problem I describe below. I'm using coverage with tox against multiple versions of python. My tox.ini file looks something like this: [tox] envlist = py27 …
bfrizb
  • 113
  • 1
  • 5
8
votes
1 answer

python tox, creating rpm virtualenv, as part of ci pipeline, unsure about where in workflow

I'm investigating how Python applications can also use a CI pipeline, but I'm not sure how to create the standard work-flow. Jenkins is used to do the initial repository clone, and then initiates tox. Basically this is where maven, and/or msbuild,…
J. M. Becker
  • 2,755
  • 30
  • 32
1 2
3
35 36