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
18
votes
2 answers

flake8/pylint fails in Tox testing environment, raises InvocationError

I've been learning about how to do testing in tox for my python project. I have (what should be) a fairly standard tox initialization file that looks like the following: [tox] envlist=py27,flake8 ... [testenv:flake8] deps=flake8 commands=flake8…
kazimir.r
  • 387
  • 1
  • 3
  • 9
18
votes
4 answers

How to specify another tox project folder as a dependency for a tox project

We have a tox-enabled project (let's call it "main" project) which has a dependency on another tox project (let's call it "library" project) - all united in one repository since it is all part of a large overarching project. How the project works…
E. T.
  • 847
  • 10
  • 26
16
votes
3 answers

Tox 0% coverage

I have a python project where I use: pipenv tox pytest and many more. Basically, I want to add tox to my gitlab pipelines. And almost everything seems to work, calling mypy, flake8 or black from tox works fine. But when I call tox -e py37 (so I…
dabljues
  • 1,663
  • 3
  • 14
  • 30
16
votes
4 answers

How to tell tox to use PyPI mirrors for installing packages?

Is there a way to tell the tox test automation tool to use the PyPI mirrors while installing all packages (explicit testing dependencies in tox.ini and dependencies from setup.py)? For example, pip install has a very useful --use-mirrors option that…
Andrey Vlasovskikh
  • 16,489
  • 7
  • 44
  • 62
14
votes
3 answers

ValueError: Unable to find resource t64.exe in package pip._vendor.distlib

i am trying to run tox commands but it shows error ValueError: Unable to find resource t64.exe in package pip._vendor.distlib ERROR: python3.7: could not install deps [-rrequirements.txt]; v =…
Somal Kant
  • 191
  • 1
  • 2
  • 4
14
votes
3 answers

Pytest says 'ModuleNotFoundError' when using tox

I have the following project structure: root |- module |- module.py |- __init__.py |- tests |- unit |- some_test.py |- integration |- another_test.py |- conftest.py |- setup.py |- tox.ini When I run python3 module/module.py…
Max Power
  • 952
  • 9
  • 24
14
votes
4 answers

Tox installs the wrong version of pip to it's virtual env

I am using tox to manage some testing environments. I have a dependency (backports.ssl-match-hostname) that I cannot download using the latest version of pip, so I need to revert back to pip 8.0.3 to allow the install to work. I have included the…
Zack
  • 13,454
  • 24
  • 75
  • 113
14
votes
2 answers

Reinstall virtualenv with tox when requirements.txt or setup.py changes

Previously I was manually using a Makefile that looked something like this: .PHONY: all all: tests .PHONY: tests tests: py_env bash -c 'source py_env/bin/activate && py.test tests' py_env: requirements_dev.txt setup.py rm -rf py_env …
anthony sottile
  • 61,815
  • 15
  • 148
  • 207
14
votes
3 answers

How to convince python tox to run tests only for the available python interpreters?

I am using python tox to run python unittest for several versions of python, but these python interpreters are not all available on all machines or platforms where I'm running tox. How can I configure tox so it will run tests only when python…
sorin
  • 161,544
  • 178
  • 535
  • 806
13
votes
1 answer

Is there a reason to have both tox.ini and setup.cfg in a python project?

I have just scaffolded a python project using PyScaffold. One thing that has caught my attention was the fact that the scaffolding generated both setup.cfg and tox.ini files. If my understanding is correct, if I were to use tox using the tox…
shamwow
  • 315
  • 2
  • 11
13
votes
2 answers

Tox fails because setup.py can't find the requirements.txt

I have added tox to my project and my tox.ini is very simple: [tox] envlist = py37 [testenv] deps = -r{toxinidir}/requirements_test.txt commands = pytest -v But when I run tox, I get the following error: ERROR: invocation failed (exit…
Hamed2005
  • 729
  • 8
  • 11
13
votes
2 answers

Error when using source in a python Tox ini file

I'm trying to get Tox and Conda to play together well. Mainly because I have a lot of non-python dependencies that need to be installed and it was easy to create Conda distributions. Then I can install everything with a simple conda…
JudoWill
  • 4,741
  • 2
  • 36
  • 48
13
votes
4 answers

ERROR collecting setup.py while trying to run py.test?

I am trying to run py.test on my package but it is trying to parse setup.py from the project root directory even if I tried to exclude it. I need to collect the tests from *.py files because the test classes are included in the modules. #…
sorin
  • 161,544
  • 178
  • 535
  • 806
12
votes
2 answers

How to run tox from github actions

I am new to tox and GitHub actions, and I am looking for a simple way to make them work together. I wrote this simple workflow: name: Python package on: [push] jobs: build: runs-on: ubuntu-latest strategy: max-parallel: 4 …
Erel Segal-Halevi
  • 33,955
  • 36
  • 114
  • 183
12
votes
2 answers

How to change Tox command with command-line parameters

How do you append options to the command Tox runs by appending that option to Tox? Specifically, how do you run a specific Django unittest with Tox? I'm trying to wrap Tox around some Django unittests, and I can run all unittests with tox, which…
Cerin
  • 60,957
  • 96
  • 316
  • 522
1
2
3
35 36