Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

adamchainz/tox-py

Repository files navigation

tox-py

image

image

image

image

pre-commit

Unmaintained (2022-12-08)

With the release of tox 4, this package is no longer necessary, and so is not being maintained. You can instead use tox 4’s -f option - see below.


Adds the --py flag to tox to run environments matching a given Python interpreter.

Installation

Use pip:

python -m pip install tox-py

Python 3.7 to 3.11 supported.

Only tox 3 is supported.

On tox 4, you can use the new -f factor option__ to select environments by Python version:

$ tox -f py310

On GitHub Actions, you can use -f with your matrix python version like so:

jobs:
  tests:
    name: Python ${{ matrix.python-version }}

    strategy:
      matrix:
        python-version:
        - 3.7
        - 3.8
        - 3.9
        - '3.10'
        - '3.11'

    steps:
    - ...

    - name: Run tox targets for ${{ matrix.python-version }}
      run: tox run -f py$(echo ${{ matrix.python-version }} | tr -d .)

Testing a Django project? Check out my book Speed Up Your Django Tests which covers loads of ways to write faster, more accurate tests.


Usage

After installation, the plugin will be automatically picked up by tox. It adds one argument: --py, which takes the version to filter environments against. The version can be specified either as a tox.ini-style dotless version number, or the special string current for the version of Python that tox is running under.

For example, to run all Python 3.9 environments:

tox --py 39

Or to run all environments matching the version of Python that tox is running under:

tox --py current

This makes configuring CI really easy: configure your CI to trigger each Python version in parallel, running tox --py current.

About

Adds the --py flag to tox to run environments matching a given Python interpreter.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages