我尝试在 django 项目目录中执行以下 bash 命令。我正在django-nose
用作TestRunner。
find . -name \tests.py -print0 | xargs -0 -Ixxx ./manage.py test xxx --settings=project_name.conf.test.settings
但我收到以下错误(取决于 tests.py 文件的数量):
OSError: No such file /Users/user/Projects/project_name/{}
同样没有-print0
停止tests.py
完整回溯(没有命令-print0
:
nosetests --verbosity 1 ./project_name/backend/tests.py
./project_name/contrib/auth/tests.py
./project_name/frontend/tests.py
--failed --stop --nocapture --debug=DEBUG --nologcapture
To reuse old database "test_db" for speed, set env var REUSE_DB=1.
To reuse old database "test_db1" for speed, set env var REUSE_DB=1.
Creating test database for alias 'default'...
Creating schema msg
Creating schema dict
Creating test database for alias 'db2'...
Creating schema msg
Creating schema dict
E
======================================================================
ERROR: Failure: OSError (No such file /Users/user/Projects/project_name/{})
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/user/.virtualenvs/project_name/lib/python2.7/site-packages/nose/failure.py", line 39, in runTest
raise self.exc_class(self.exc_val)
OSError: No such file /Users/user/Projects/project_name/{}
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)
Destroying test database for alias 'default'...
Destroying test database for alias 'db2'...
xargs
在这种情况下使用的正确方法是什么?