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

Table of Contents

tox-min-req is a tox plugin that simplify the minimum requirements testing.

The minimum requirements is to validate if minimum requirements are satisfied.

To use this plugin you need to use MIN_REQ environment variable either in call or in setenv section of tox configuration.

Why use this inseted of deps attribute of env section?

One of the possible solution is to use deps section in tox configuration to install dependecies in older version.

But deps and package are installed in two independent steps. So it means that some of dependencies could be upgraded or downgraded when installing package.

The PIP_CONSTRAINT variable is used to pin the dependencies. And it will apply to 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 allow to provide following environment configuration options:

  • min_req - set to 1 to enable the minimum requirements testing, could be used instead of environment variable.
  • min_req_constraints - list of additional constrains that will be used to generate the constrains file. It could be useful in following scenarios:
    • Some of dependencies in old version is incompatible with its dependencies in latest version. (see Known issues)
    • Maintainers would like to test also some problematic dependencies in old version, but not 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 generated constrains file, not parsed.

Known issues

Pinning only direct dependencies

As this plugin parse only setup.cfg or pyproject.toml file, it is not possible to pin the indirect dependencies. To provide the indirect dependencies pinning, the min_req_constraints environment configuration option could be used.

Space in constrains file path

pip is using the space as file path separator in PIP_CONSTRAINT variable. The plugin is storing the generated constrains file in the .tox temporary directory. If the path to the temporary directory contains space, the pip will not be able to find the constrains file.

In such situation there is a need to set the TOX_MIN_REQ_CONSTRAINTS environment variable to the path where constrains file could 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 constrains 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.3.tar.gz (15.0 kB view hashes)

Uploaded Source

Built Distribution

tox_min_req-0.0.3-py3-none-any.whl (7.5 kB view hashes)

Uploaded Python 3

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