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
83
votes
4 answers

How do I run tox in a project that has no setup.py?

I would like to use tox to run my unittests in two virtualenvs, since my application has to support 2 different Python versions. My problem is that tox requires a setup.py, but I have none since my application is not a module and has its own…
Kjir
  • 4,437
  • 4
  • 29
  • 34
74
votes
4 answers

How can tox install the modules via the requirements file?

Our python project has a requirements.txt file which lists some dependent module. We used to use pip install -r requirements.txt to install these dependencies. We are now using tox to build up the test environment. My question is that how can we…
waitingkuo
  • 89,478
  • 28
  • 112
  • 118
45
votes
2 answers

How to get coverage reporting when testing a pytest plugin?

Context I am updating an inherited repository which has poor test coverage. The repo itself is a pytest plugin. I've changed the repo to use tox along with pytest-cov, and converted the "raw" tests to use pytester as suggested in the pytest…
Thomas Thorogood
  • 2,150
  • 3
  • 24
  • 30
42
votes
4 answers

pip install test dependencies for tox from setup.py

I made my project with setuptools and I want to test it with tox. I listed dependencies in a variable and added to setup() parameter (tests_require and extras_require). My project needs to install all of the dependencies listed in tests_require to…
item4
  • 785
  • 1
  • 7
  • 11
41
votes
3 answers

How to run only one test in tox?

I'm trying to write a new test for a project and I'd like to test only that one test in tox. I'm already completely sure that other tests are fine, I don't need them being run every time. The only suggestion I've found doesn't work with ERROR:…
int_ua
  • 1,646
  • 2
  • 18
  • 32
33
votes
1 answer

How to import all the environment variables in tox

I'm using following in setenv to import the environment variable from where I run, but is there a way to import all the variables so that I don't really need to import one by one. e.g: {env:TEMPEST_CONFIG:} and {env:TEMPEST_CONFIG_DIR:} used to…
Manjunath Kumatagi
  • 361
  • 1
  • 4
  • 11
30
votes
4 answers

How to run Tox with Travis-CI

How do you test different Python versions with Tox from within Travis-CI? I have a tox.ini: [tox] envlist = py{27,33,34,35} recreate = True [testenv] basepython = py27: python2.7 py33: python3.3 py34: python3.4 py35: python3.5 deps…
Cerin
  • 60,957
  • 96
  • 316
  • 522
30
votes
4 answers

Is it possible to use tox with conda-based Python installations?

The Python testing tool tox seems to be designed to work with virtualenv. Can it also work on conda/anaconda-based Python installations?
cmeeren
  • 3,890
  • 2
  • 20
  • 50
28
votes
2 answers

Making py.test, coverage and tox work together: __init__.py in tests folder?

I'm having a weird problem with tox, py.test, coverage and pytest-cov: when py.test with the --cov option is launched from tox, it seems to require an __init__.py file in the tests folder which is not immediately obvious. While writing this post, I…
aldanor
  • 3,371
  • 2
  • 26
  • 26
27
votes
3 answers

How to set the environment variable in tox?

I have tox 2.9.1 $ tox --version 2.9.1 imported from /Library/Python/2.7/site-packages/tox/__init__.pyc registered plugins: tox-pyenv-1.1.0 at /Library/Python/2.7/site-packages/tox_pyenv.pyc File structure and content are as below $ tree…
Nilesh
  • 20,521
  • 16
  • 92
  • 148
24
votes
7 answers

Tox WARNING:test command found but not installed in testenv

I am using tox for my project. Here is my tox.ini file: [tox] envlist = py27, lint, coverage skipsdist = True [testenv:py27] deps = -rrequirements.txt commands = python -m unittest discover -s ./tests [testenv:coverage] commands = …
primer
  • 381
  • 1
  • 2
  • 7
22
votes
4 answers

Conditional Commands in tox? (tox, travis-ci, and coveralls)

tl;dr: I'm setting up CI for a project of mine, hosted on github, using tox and travis-ci. At the end of the build, I run converalls to push the coverage reports to coveralls.io. I would like to make this command 'conditional' - for execution only…
20
votes
1 answer

How can I get tox and poetry to work together to support testing multiple versions of a Python dependency?

I am switching a project that currently uses pipenv to poetry as a test to see what the differences are. The project is a simple, redistributable, Django app. It supports Python 3.6-8, and Django 2.2 and 3.0. I have a tox.ini file that covers all…
Hugo Rodger-Brown
  • 11,054
  • 11
  • 52
  • 78
20
votes
1 answer

Python packaging: Generate a python file at installation time, have this work with tox

I want to generate a python file at installation time. I want this work with both python setup.py develop, python setup.py install and pip install. So far so good. However I also want this to work with tox. This is where I am having problems. The…
Att Righ
  • 1,439
  • 1
  • 16
  • 29
19
votes
5 answers

python tox: how to use a different python envlist in environment

Here is my tox.ini: [tox] envlist = py27,py35 [testenv] deps = Flask connexion pytest coverage pytest-cov requests six commands=pytest --junitxml xunit-reports/xunit-result-XXX.xml --cov {envsitepackagesdir}…
Tommy
  • 12,588
  • 14
  • 59
  • 110
1
2 3
35 36