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
3
votes
1 answer

pre-commit vs tox | what's the difference | scope of use

Tox: https://tox.wiki/en/latest/ pre-commit: https://pre-commit.com/ I would like to understand the borders for both choices. I know that pre-commit creates a py environment - same as tox. To me, their architecture looks a bit the same. Some people…
3
votes
1 answer

How to configure coverage with tox?

I am using tox to run tests on different envs using tox -p(run in parallel), but have a problem with coverage report generation for all tests. tox.ini: [tox] envlist = env1,ev2,report skipsdist=True [base] deps = pytest [testenv:env1] deps =…
dytyniak
  • 364
  • 3
  • 10
3
votes
1 answer

Tox cannot find setup.cfg file

I am trying to use tox-gh-actions to automate testing on github pushes. In order to test the implementation, I am locally using tox with setup.cfg, command I use python -m tox but I always end up with the error: ERROR: tox config file (either…
veedata
  • 1,048
  • 1
  • 9
  • 15
3
votes
1 answer

Attempting to run pytest and tox raises ModuleNotFoundError

I'm having issues testing my package with pytest and tox. When attempting to run both I receive ModuleNotFoundError. Pytest does find test_hello.py but fails immediate on trying to import my package for the test. I am using PyCharm IDE which…
Skynet
  • 84
  • 1
  • 9
3
votes
2 answers

InvocationError while running flake8 in tox.ini

It looks like I can't pass the relative nor absolute path to the folder that should be checked by flake8 inside the tox.ini file. After performing a code in the shell: flake8 tests/ Result is correct: tests/unit\test.py:17:91: E501 line too long…
Alan Filas
  • 33
  • 4
3
votes
1 answer

ruamel.yaml requires python-dev in Ubuntu container build

I recently switched from pyyaml to ruamel.yaml at the request of my OSS project's maintainer. Everything worked fine until I submitted the PR for the project's Buildkite Verification build which uses tox to automate multiple python version testing…
32bits
  • 683
  • 7
  • 10
3
votes
1 answer

Access env variable with tox and Github Action

TL;DR: Empty env variables, but I don't know why. I have a repo with a local .env file, and a Github Action workflow to launch some workflows when I push my commits to remote. I have also put the secrets of the env file as key-value pairs inside…
crissal
  • 2,547
  • 7
  • 25
3
votes
1 answer

Why is tox not using pyenv python interpreter?

My pyenv is using Python 3.7, and yet when running tox on a project that has envlist = py37, it is using Python 2.7 to run the setup.py and failing: Traceback (most recent call last): File "setup.py", line 3, in from setuptools import…
jacob
  • 2,762
  • 1
  • 20
  • 49
3
votes
0 answers

sqlite3.OperationalError: no such table: dag when running in tox environment

I have a github action which is running a tox file. The tox file is running some very basic tests on apache airflow. For example: workflow.yml - uses: actions/checkout@v1 - some more steps - name: Run tox run: tox tox.ini [tox] envlist =…
Oliver Robie
  • 818
  • 2
  • 11
  • 30
3
votes
2 answers

CircleCI for simple Python project with tox: how to test multiple Python environments?

I have a Python project for which I use tox to run the pytest-based tests. I am attempting to configure the project to build on CircleCI. The tox.ini lists both Python 3.6 and 3.7 as environments: envlist = py{36,37,},coverage I can successfully…
James Adams
  • 8,448
  • 21
  • 89
  • 148
3
votes
1 answer

Basic tox setup to test a package

I am trying to use tox to test a package I am writing and I cannot get it to work. My setup.cfg contains the following section: [tox] envlist = py36,py37,py36-black [testenv] deps = pytest commands = pytest tests [testenv:py36-black] deps…
Holt
  • 36,600
  • 7
  • 92
  • 139
3
votes
1 answer

Django + tox: Apps aren't loaded yet

I'm migrating a Django project to use Tox and pytest. I'm getting the following when running tox. _________________________________________ ERROR collecting fixtureless/tests/test_django_project/test_app/tests/test_factory.py…
Rico
  • 5,692
  • 8
  • 46
  • 63
3
votes
1 answer

Running tox with C extension module

I am a newbie to tox. I have a python package that has a C extension module written for python2.7. The web told me that I need to use "tox --wheel" for this case. However, I couldn't get "tox --wheel" to locate my C source code. Can someone lend me…
ymc
  • 77
  • 3
3
votes
0 answers

How to Install Dependencies from a Local Python Repository with Tox?

Introduction I would like to install some dependencies (local-package1 and local-package2) into a virtualenv using Tox. Those dependencies are packages that only exist on my local Python Package Index (inside of an Artifactory…
karobar
  • 1,250
  • 8
  • 30
  • 61
3
votes
1 answer

Determine required Python versions from tox.ini and install if required

tox documentation suggests that the versions of Python that you want to test against must already be installed in the environment, otherwise you'll experience errors. With that in mind, is there a generally accepted practice of checking envlist in…
runnerpaul
  • 5,942
  • 8
  • 49
  • 118