本文介绍了Travis CI查找和运行测试的Python项目结构应该是什么样的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I currently have a project with the following .travis.yml file:

language: python
install: "pip install tox"
script: "tox"

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

Locally, tox properly executes and runs 35 tests, but on Travis CI, it runs 0 tests.

更多详细信息: https://travis-ci.org/neverendingqs/pyiterable/builds/78954867

我还尝试了其他方法,包括:

I also tried other ways, including:

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"

他们也找不到任何测试.

我的项目结构为像这样:

- ...
- <module>
- tests (for the module)
- ...

项目/文件夹的结构是否正确?

Are the project/folders structured incorrectly?

推荐答案

文件夹结构没有问题.

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

It looks like the files on Travis CI are considered executable (logs from 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

我根据.修复了一些不相关的错误之后,我能够使测试运行@ https://travis-ci.org/neverendingqs/pyiterable/builds/79049983

I changed tox.ini to run nosetests with --exe (nosetests --exe --with-coverage --cover-package=pyiterable), based on 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 CI查找和运行测试的Python项目结构应该是什么样的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 06:35