对于 Travis CI 查找和 运行 测试,Python 项目结构应该是什么样的?
What should a Python project structure look like for Travis CI to find and run tests?
我目前有一个包含以下 .travis.yml
文件的项目:
language: python
install: "pip install tox"
script: "tox"
在本地,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"
他们也找不到any tests。
我的项目结构是Like This:
- ...
- <module>
- tests (for the module)
- ...
project/folders 的结构是否错误?
文件夹结构没有问题。
看起来 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
我将 tox.ini
更改为 运行 nosetests
和 --exe
(nosetests --exe --with-coverage --cover-package=pyiterable
),基于 Run all Tests in Directory Using Nose. After fixing some non-related errors, I was able to get the tests to run @ https://travis-ci.org/neverendingqs/pyiterable/builds/79049983!
我目前有一个包含以下 .travis.yml
文件的项目:
language: python
install: "pip install tox"
script: "tox"
在本地,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"
他们也找不到any tests。
我的项目结构是Like This:
- ...
- <module>
- tests (for the module)
- ...
project/folders 的结构是否错误?
文件夹结构没有问题。
看起来 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
我将 tox.ini
更改为 运行 nosetests
和 --exe
(nosetests --exe --with-coverage --cover-package=pyiterable
),基于 Run all Tests in Directory Using Nose. After fixing some non-related errors, I was able to get the tests to run @ https://travis-ci.org/neverendingqs/pyiterable/builds/79049983!