【问题标题】:tox throws and error when running nosetest command运行nosetest命令时tox抛出和错误
【发布时间】:2019-07-01 06:28:33
【问题描述】:

我创建了这个tox.ini 文件:

[tox]
envlist = py37

[testenv]
commands = /bin/sh nosetests config_test.test_config_sdk:test_bucket_existing

它会抛出这个错误:

$ tox
GLOB sdist-make: /Users/me/git/config-test/setup.py
py37 create: /Users/me/git/config-test/.tox/py37
py37 inst: /Users/me/git/config-test/.tox/.tmp/package/1/sdk-config-1.0.0.zip
py37 installed: sdk-config==1.0.0,config-test==1.0.0
py37 run-test-pre: PYTHONHASHSEED='2567467531'
py37 runtests: commands[0] | /bin/sh nosetests config_test.test_config_sdk:test_bucket_existing
/Users/me/git/config-test/venv/bin/nosetests: line 3: import: command not found
/Users/me/git/config-test/venv/bin/nosetests: line 4: import: command not found
from: can't read /var/mail/nose
/Users/me/git/config-test/venv/bin/nosetests: nosetests: line 9: syntax error near unexpected token `('
/Users/me/git/config-test/venv/bin/nosetests: nosetests: line 9: `    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])'
ERROR: InvocationError for command '/bin/sh nosetests config_test.test_config_sdk:test_bucket_existing' (exited with code 2)
__________________________________________________________________________ summary ___________________________________________________________________________
ERROR:   py37: commands failed

nosetests config_test.test_config_sdk:test_bucket_existing 在我的终端中运行时可以工作。

是不是我做错了什么,或者这个命令在 tox 中是不可能的?

【问题讨论】:

    标签: python python-3.x nose setup.py tox


    【解决方案1】:

    这是您为tox 注册运行的命令:

    /bin/sh nosetests config_test.test_config_sdk:test_bucket_existing
    

    这里,nosetests 作为 shell 脚本调用;但这是误导。
    nosetests是你PATH中的一个可执行python脚本,应该直接执行。

    将命令注册为:

    nosetests config_test.test_config_sdk:test_bucket_existing
    

    解决了错误。

    【讨论】:

      猜你喜欢
      • 2015-10-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-17
      • 2021-09-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多