Skip to main content

run commands in a tox testenv wiht the same as tox

Project description

tox-direct

tox plugin to be able to run commands directly without creating a virtual environments first.

This might seem pointless but if tox is used as a single entry point into all developer workflows this can be useful in certain scenarios - e.g.:

  • something needs to be done which does not require a virtual environment (because only system commands are run)
  • something has to run in the same interpreter that is running tox (e.g. testing things inside a docker container where everything is already set up correctly in a dedicated virtual environment)

At the moment there are two ways to run tox envs in direct mode:

  1. if the testenv name contains the word "direct"
  2. if the environment variable TOX_DIRECT is set

minimal example:

[tox]
skipdist = True

[testenv:direct-action]
skip_install = True
commands = which python

[testenv:something-else]
skip_install = True
commands = which python

If I run these in a virtual environment (.virtualenvs/tmp) with tox and tox-direct installed:

$ TOX_DIRECT=1 tox -qre something-else

We need direct action! No virtual environment! Ain't Nobody Got Time for That!
/home/ob/.virtualenvs/tmp/bin/python
_______________________________ summary _______________________________________
  something-else: commands succeeded
  congratulations :)
$ tox -qre direct-action  

We need direct action! No virtual environment! Ain't Nobody Got Time for That!
/home/ob/.virtualenvs/tmp/bin/python
_______________________________ summary _______________________________________
  direct-action: commands succeeded
  congratulations :)

So everything would be executed (and also installed) directly in that environment.

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-direct-0.1.0.tar.gz (2.3 kB view hashes)

Uploaded Source

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