相关疑难解决方法(0)

使用Nose在目录中运行所有测试

我需要能够通过在Linux shell中键入一行来在当前目录中运行所有测试.在某些目录中,这很好用.但在其他情况下,当我输入"nosetests"时,没有进行任何测试.如果我单独调用它们,测试将运行,但我需要它们全部自动运行.这是一个不起作用的目录:

/extwebserver
    __init__.py
    test_Detection.py
    test_Filesystem.py 
    test_Hardware.py
    ...
Run Code Online (Sandbox Code Playgroud)

当我在父目录中运行"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 …
Run Code Online (Sandbox Code Playgroud)

python nose

23
推荐指数
2
解决办法
2万
查看次数

Python导入在travisCI上失败但在本地失败

我正在尝试将TravisCI集成到我的工作流程中,并且意识到我有一些依赖项,因为我的旧目录结构(没有自包含的,virtualenv可用的git repos).

当我尝试在nosetests本地运行时,它运行测试就好了; 当TravisCI尝试运行它们时,它会失败并出现import错误.具体来说,我有,作为我的测试脚本中的一行:

from myproject import something
Run Code Online (Sandbox Code Playgroud)

我的目录结构在我的git repo里面myproject是这样的:

.travis.yml
requirements.txt
something.py
tests/
    test_something.py
Run Code Online (Sandbox Code Playgroud)
  • 我试过让它在本地失败(因为那时我可能会理解TravisCI问题),但是无法完成它.
  • 我尝试使用常规python运行,并使用添加nose到其中的virtualenv,requirements.txt测试总是在本地传递.

我觉得我仍然没有理解绝对与相对的进口,我不知道这是否会在这里发挥作用,或者我只是在我的项目中做一些明显和愚蠢的事情.

期望的结果:找出TravisCI失败的原因,并相应地修复我的回购,这样我就可以在本地和TravisCI上提交并正确构建.如果这需要更大幅度的改变,比如"你应该setup.py对环境有所作为"或类似的话 - 请告诉我.我是Python的新方面的新手,并且发现当前的文档非常不清楚.

作为一个仅供参考,我发现这个问题并且添加--exe没有帮助,或者似乎是同一个问题.

python nose travis-ci

11
推荐指数
1
解决办法
1363
查看次数

标签 统计

nose ×2

python ×2

travis-ci ×1