Skip to main content

Tox plugin to run tests with minimal requirements base on setup.cfg or pyproject.toml

Project description

tox-min-req

PyPI - Version PyPI - Python Version Code style: black Development Status Tests PyPI - License codecov Downloads

Table of Contents

tox-min-req is a tox plugin that simplifies
minimum requirements (min-req) testing.

Minimum requirements testing is important to validate whether the minimum requirements are satisfied.

After installing, to use this plugin you need to use MIN_REQ environment variable either in the call (e.g. MIN_REQ=1 tox -e py38-linux-pyqt5) or in setenv section of your tox configuration.

Why use this instead of deps attribute of the tox env section?

One alternative solution is to use the deps section in tox configuration to install min-req dependecies.

However, packages from deps and the actual package to be tested are installed in two independent steps. This means that some of the min-req dependencies could be upgraded or downgraded when installing the actual package.

The PIP_CONSTRAINT and UV_CONSTRAINT variables are used to pin the dependencies; it will apply to the call of pip install during dependency resolving.

Installation

pip install tox-min-req

License

tox-min-req is distributed under the terms of the MIT license.

Usage

The basic usage is to set the MIN_REQ environment variable to 1

$ MIN_REQ=1 tox -e py37

Configuration options

The tox-min-req plugin allows one to provide the following environment configuration options:

  • min_req - set to 1 to enable the minimum requirements testing; can be used instead of setting the environment variable.
  • min_req_constraints - list of additional constraints that will be used to generate the constraints file. This is useful in following scenarios:
    • Some of dependencies of an old version are incompatible with dependencies in latest version (see Known issues, below).
    • Maintainers would like to also test some problematic dependencies an old version, but not the oldest supported version.
[tox]
envlist = py310

[testenv]
extras = test
recreate = True
commands = pytest test_file.py
min_req = 1
min_req_constraints=
    coverage==6.5.0
    babel==2.6.0
    six==1.14.0
    -r {project_dir}/constraints.txt

Please note that -r {project_dir}/constraints.txt will be put in the generated constraints file—it will not be parsed.

Known issues

Pinning only direct dependencies

Because this plugin only parses setup.cfg or pyproject.toml files, it is not possible to pin any indirect dependencies. To pin indirect dependencies, the min_req_constraints environment configuration option should be used.

Spaces in the constraints file path

pip uses spaces as file path separators in the PIP_CONSTRAINT variable. This plugin stores the generated constraints file in a .tox temporary directory. As a result, if the path to the temporary directory contains spaces, then pip will not be able to find the constraints file.

In such a scenatio, one needs to set the TOX_MIN_REQ_CONSTRAINTS environment variable to the path where constraints file can be written.

$ TOX_MIN_REQ_CONSTRAINTS=/tmp MIN_REQ=1 tox -e py37

It is also possible to use the --min-req-constraints-path command line option to set the path to the constraints file.

$ tox --min-req-constraints-path=/tmp -e py37

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tox_min_req-0.0.9.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

tox_min_req-0.0.9-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file tox_min_req-0.0.9.tar.gz.

File metadata

  • Download URL: tox_min_req-0.0.9.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tox_min_req-0.0.9.tar.gz
Algorithm Hash digest
SHA256 c83ae304a2b2c99266123d1d6fe028199c64681e979d138a37178b7bae3d06d8
MD5 b45ffab8999d7c5e1797936afb505d53
BLAKE2b-256 95ab7e58ca38156f899ff28c087782b57aa5212dfbe5c8e3eb601da8d41c5e71

See more details on using hashes here.

File details

Details for the file tox_min_req-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: tox_min_req-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for tox_min_req-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 b6a6f175d12fa8bd90eaa7eaf54b7bdd9c12a232e9faf780fa7623479ad00b48
MD5 4f99db0ee1a3a51d64e9d49e94859d7b
BLAKE2b-256 b4c3fb5f38608fbb802104cc0348c601c52cf7b7ec727b102a4af98adfdaade1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page