我需要能够通过在Linux shell中键入一行来在当前目录中运行所有测试.在某些目录中,这很好用.但在其他情况下,当我输入"nosetests"时,没有进行任何测试.如果我单独调用它们,测试将运行,但我需要它们全部自动运行.这是一个不起作用的目录:
/extwebserver
    __init__.py
    test_Detection.py
    test_Filesystem.py 
    test_Hardware.py
    ...
当我在父目录中运行"nosetests"时,将运行某个子目录中的所有测试,但不会运行/ extwebserver或其他子目录或父目录本身的测试.
编辑 这是输出:
matthew@Matthew-Laptop:~/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing$ nosetests -vv --collect-only
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/baseTestCase.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/run.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Detection.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Filesystem.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Hardware.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Mode.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_System.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_View.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/extwebserver/test_Webserver.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/mocks/bottle.py is executable; skipped
nose.selector: INFO: /home/matthew/Documents/ParkAssist/m3/linux/appfs/master/usr/bin/piopio/testing/utils/test_timestamps.py is …我试图使用Django的鼻子在我目前的项目,但我无法弄清楚如何让鼻子跑我的测试.所以我开始了一个简单的Django 1.4.1项目来了解鼻子.但即使在这个简单的测试项目中,我也无法运行它.
在继续之前:我知道Stackoverflow上有很多类似的问题,比如这个问题:
但谷歌搜索后,阅读博客文章和StackOverflow答案我仍然无法运行.
pip install django django-nose nose.django-admin.py startproject djangonosetest.创建项目.manage.py startapp testapp编辑settings.py:
ENGINE为django.db.backends.sqlite3django_nose,testapp以INSTALLED_APPSTEST_RUNNER = 'django_nose.NoseTestSuiteRunner'.跑 manage.py test
但我得到的只是这个输出:
nosetests --verbosity 1
Creating test database for alias 'default'...
----------------------------------------------------------------------
Ran 0 tests in 0.000s
OK
Destroying test database for alias 'default'...
但至少应该运行默认的测试用例.
当我运行python manage.py test djangonosetest.testapp.tests:SimpleTest它时,将运行测试.但是,如果我必须为每个测试文件执行此操作,那似乎有点矫枉过正.但它证明了测试可以运行.
当我跑manage.py test -v 3(高级别级别)时,这出现了:
nose.selector: INFO: /Users/Jens/Projects/Django/djangonosetest/djangonosetest/settings.py …我不确定如何使鼻子模块的__main__处理程序工作.我在测试模块的末尾有这个:
if __name__ == "__main__":
    import nose
    nose.main()
这给了我:
----------------------------------------------------------------------
Ran 0 tests in 0.002s
OK
但它通过命令行运行相同的东西,它找到测试并执行它们:
MacBook-Pro:Storage_t meloam$nosetests FileManager_t.py 
............E..
======================================================================
ERROR: testStageOutMgrWrapperRealCopy (WMCore_t.Storage_t.FileManager_t.TestFileManager)
----------------------------------------------------------------------
SNIP
----------------------------------------------------------------------
Ran 15 tests in 0.082s
FAILED (errors=1)
我一直在玩通过不同的参数到nose.main()但我找不到任何有用的东西.我错过了一些非常明显的东西吗
谢谢