对于Travis CI来说,查找和运行测试的Python项目结构应该是什么样的?

nev*_*gqs 6 python nose travis-ci tox

我目前有一个包含以下.travis.yml文件的项目:

language: python
install: "pip install tox"
script: "tox"
Run Code Online (Sandbox Code Playgroud)

在本地,tox正确执行并运行35个测试,但在Travis CI上,它运行0个测试.

更多细节:https://travis-ci.org/neverendingqs/pyiterable/builds/78954867

我也尝试过其他方式,包括:

language: python
python:
  - "2.6"
  - "2.7"
  - "3.2"
  - "3.3"
  - "3.4"
  - "3.5.0b3"
  - "3.5-dev"
  - "nightly"
# also fails with just `nosetest` and no `install` step
install: "pip install coverage unittest2"
script: "nosetests --with-coverage --cover-package=pyiterable"
Run Code Online (Sandbox Code Playgroud)

他们也找不到任何测试.

我的项目结构是这样的:

- ...
- <module>
- tests (for the module)
- ...
Run Code Online (Sandbox Code Playgroud)

项目/文件夹结构不正确吗?

nev*_*gqs 2

文件夹结构没有任何问题。

看起来 Travis CI 上的文件被认为是可执行的(来自https://travis-ci.org/neverendingqs/pyiterable/builds/79049179的日志):

nosetests --verbosity=3
nose.config: INFO: Ignoring files matching ['^\\.', '^_', '^setup\\.py$']
nose.selector: INFO: /home/travis/build/neverendingqs/pyiterable/LICENSE.txt is executable; skipped
nose.selector: INFO: /home/travis/build/neverendingqs/pyiterable/pyiterable/iterable.py is executable; skipped
nose.selector: INFO: /home/travis/build/neverendingqs/pyiterable/readme.md is executable; skipped
nose.selector: INFO: /home/travis/build/neverendingqs/pyiterable/setup.cfg is executable; skipped
nose.selector: INFO: /home/travis/build/neverendingqs/pyiterable/tox.ini is executable; skipped
nose.selector: INFO: /home/travis/build/neverendingqs/pyiterable/tests/test_iterable.py is executable; skipped
Run Code Online (Sandbox Code Playgroud)

我更改为使用( )tox.ini运行,基于使用 Nose 运行目录中的所有测试。修复了一些不相关的错误后,我能够让测试运行@ https://travis-ci.org/neverendingqs/pyiterable/builds/79049983nosetests--exenosetests --exe --with-coverage --cover-package=pyiterable