2

我正在尝试在我制作的模块上运行 Travis-CI。Nosetests 在我的本地机器上以优异的成绩通过,但由于某种原因,该test.py文件无法导入我的项目。以下是 Travis-CI 的完整输出:

Using worker: ppp3.worker.travis-ci.org:php-4

$ cd ~/builds
$ git clone --branch=master --depth=100 --quiet git://github.com/louist87/Scrappy.git louist87/Scrappy
$ cd louist87/Scrappy
$ git checkout -qf 68d1291c8a81638554d036aa01215632a6661623
$ source ~/virtualenv/python2.7/bin/activate
$ python --version
Python 2.7.3
$ pip --version
pip 1.2.1 from /home/travis/virtualenv/python2.7/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg (python 2.7)
$ pip install -r requirements.txt --use-mirrors
Downloading/unpacking guessit>=0.5.2 (from -r requirements.txt (line 1))
  Downloading guessit-0.5.3.tar.gz (45kB): 45kB downloaded
  Running setup.py egg_info for package guessit

Downloading/unpacking tvdb-api>=1.8.2 (from -r requirements.txt (line 2))
  Downloading tvdb_api-1.8.2.tar.gz
  Running setup.py egg_info for package tvdb-api

Downloading/unpacking hachoir-metadata>=1.3.3 (from -r requirements.txt (line 3))
  Downloading hachoir-metadata-1.3.3.tar.gz (52kB): 52kB downloaded
  Running setup.py egg_info for package hachoir-metadata
    Warning: unable to recompile dialog.ui to dialog_ui.py using pyuic4
    (use command "-c egg_info --egg-base pip-egg-info --disable-qt" to disable this warning)


Downloading/unpacking hachoir-core>=1.3.3 (from -r requirements.txt (line 4))
  Downloading hachoir-core-1.3.3.tar.gz (91kB): 91kB downloaded
  Running setup.py egg_info for package hachoir-core

Downloading/unpacking hachoir-parser>=1.3.4 (from -r requirements.txt (line 5))
  Downloading hachoir-parser-1.3.4.tar.gz (359kB): 359kB downloaded
  Running setup.py egg_info for package hachoir-parser

    warning: no files found matching 'metadata_csv.py'
Installing collected packages: guessit, tvdb-api, hachoir-metadata, hachoir-core, hachoir-parser
  Running setup.py install for guessit

  Running setup.py install for tvdb-api

  Running setup.py install for hachoir-metadata
    Warning: unable to recompile dialog.ui to dialog_ui.py using pyuic4
    (use command "-c install --record /tmp/pip-Xc_ilb-record/install-record.txt --single-version-externally-managed --install-headers /home/travis/virtualenv/python2.7/include/site/python2.7 --disable-qt" to disable this warning)

    changing mode of build/scripts-2.7/hachoir-metadata from 664 to 775
    changing mode of build/scripts-2.7/hachoir-metadata-gtk from 664 to 775
    changing mode of build/scripts-2.7/hachoir-metadata-qt from 664 to 775
    deleting hachoir_metadata.egg-info/requires.txt

    changing mode of /home/travis/virtualenv/python2.7/bin/hachoir-metadata-qt to 775
    changing mode of /home/travis/virtualenv/python2.7/bin/hachoir-metadata to 775
    changing mode of /home/travis/virtualenv/python2.7/bin/hachoir-metadata-gtk to 775
  Running setup.py install for hachoir-core

  Running setup.py install for hachoir-parser
    deleting hachoir_parser.egg-info/requires.txt

    warning: no files found matching 'metadata_csv.py'
Successfully installed guessit tvdb-api hachoir-metadata hachoir-core hachoir-parser
Cleaning up...
$ nosetests -w tests/
E
======================================================================
ERROR: Failure: ImportError (No module named scrappy.core)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/nose/loader.py", line 390, in loadTestsFromName
    addr.filename, addr.module)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/nose/importer.py", line 39, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/home/travis/virtualenv/python2.7/local/lib/python2.7/site-packages/nose/importer.py", line 86, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/travis/builds/louist87/Scrappy/tests/test.py", line 8, in <module>
    import scrappy.core as scrappy
ImportError: No module named scrappy.core

----------------------------------------------------------------------
Ran 1 test in 0.004s

FAILED (errors=1)

Done. Build script exited with: 1

请注意,这Scrappy是我的项目的名称,这就是导入失败的原因。

这是我的.travis.yml文件:

language: python
python:
  - "2.7"
install: "pip install -r requirements.txt --use-mirrors"
script: "nosetests -w tests/"

知道有什么问题吗?

4

1 回答 1

2

develop好的,事实证明 Travis-CI在安装目标包时并没有隐式执行。

script通过将 YAML 文件中的行编辑为:

script:  "python setup.py develop && nosetests -w tests/"
于 2013-01-18T15:37:35.023 回答