How can I add to $PATH with tox?

时间:2016-02-12 20:32:40

标签: python django testing protractor 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.

2 个答案:

答案 0 :(得分:2)

I think it should work if you modify your path in the UPDATE FGMULTI SET NON_CONFORM_ALLOCATABLE = 'Y' WHERE IN_Date = CurrentDate AND exists (SELECT 1 FROM arinvt ar WHERE fgmulti.arinvt_id = ar.id AND (ar.Class LIKE 'CP%' OR ar.Class LIKE 'FG%' OR ar.Class LIKE 'IN%' OR ar.Class LIKE 'LA%' OR ar.Class LIKE 'PK%')); file to include manage.py directory, because the Django management command line uses django-protractor.

答案 1 :(得分:2)

使用环境变量tox提供语法{env:VARIABLE}。要将它们设置为tox,请提供setenv部分。

这些可以一起用于修改命令可以使用的PATH变量:

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

commands = 
  echo {env:PATH}

在某些情况下可能有效的另一个选项是符号链接或在PATH的可写路径中下载二进制文件,希望我们总是有一个可用的:虚拟环境'二进制文件夹,在tox中为{envbindir}