简体   繁体   English

运行鼻子测试命令时出现毒素抛出和错误

[英]tox throws and error when running nosetest command

I created this tox.ini file: 我创建了这个tox.ini文件:

[tox]
envlist = py37

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

It throws this error: 它引发此错误:

$ 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 works when I run it in my terminal though. nosetests config_test.test_config_sdk:test_bucket_existing可以在终端上运行。

Have I done something wrong or is this command not possible in tox? 我做错了什么吗,或者这个命令无法在tox中执行?

This is the command you have registered for tox to run: 这是您注册的tox运行命令:

/bin/sh nosetests config_test.test_config_sdk:test_bucket_existing

Here, nosetests is invoked as a shell script; 在这里, nosetests被作为shell脚本调用; but that's misleading. 但这是误导。
nosetests is an executable python script in your PATH and should be executed directly. nosetests是您PATH的可执行python脚本,应直接执行。

Registering the command as: 将命令注册为:

nosetests config_test.test_config_sdk:test_bucket_existing

solves the error. 解决错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM