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.8.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

tox_min_req-0.0.8-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tox_min_req-0.0.8.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for tox_min_req-0.0.8.tar.gz
Algorithm Hash digest
SHA256 d05a49f547cdaf694f99b1991861595d49f1196babe42194c53472bfed1aed9e
MD5 a0b7a9db1d24c7ced6fbfc78b0b0bff5
BLAKE2b-256 e57a8c824fb80668611c787d4eced2141063c6fc9791af52a8678e4ab892be3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tox_min_req-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.4

File hashes

Hashes for tox_min_req-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 c45f00c711d71ff5cd74be4825e113af0928355a625b9cb8e833b8acc8697448
MD5 7a7c48e693d6caf01ef2e58bff1fc1f1
BLAKE2b-256 c8b406f5ba5cfecfe69fd11f05bd541ade3e58b4ddaa47cb9989f6b0de16af3b

See more details on using hashes here.

Supported by

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