Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add to $PATH with tox?

I'm using tox to run protractor tests which will test an application which uses django+angularjs, there is a glue library (django-protractor) which makes this easier, except that it makes the call to protractor inside a django management command, and relies on $PATH to show it where protractor is.

So if I set the $PATH properly before running tox, it works fine, but I'd rather not require all the devs to do that manually.

like image 750
Lefunque Avatar asked Oct 28 '25 08:10

Lefunque


1 Answers

To use environment variables tox provides the syntax {env:VARIABLE}. To set them tox provides the setenv section.

These can be used together to modify the PATH variable that can be used by commands:

[testenv]
setenv =
  PATH = {env:PATH}{:}/path/to/protractor

commands = 
  echo {env:PATH}

Another option that might work in some cases is symlink or download the binary in a writable path of the PATH, hopefully we always have one available: the virtual environments' binary folder, which is {envbindir} in tox.

like image 167
undu Avatar answered Oct 31 '25 03:10

undu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!