2013-01-18 26 views
2

我正在尝试在我制作的模块上运行Travis-CI。 Nosetests通过我的本地机器飞行颜色,但由于某种原因test.py文件无法导入我的项目。下面是从特拉维斯-CI输出全:当我尝试运行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/" 

任何想法可能是错误的?

回答

2

好的,所以事实证明,Travis-CI在安装目标软件包时不会执行隐含的develop

这是固定通过编辑script线在YAML文件:

script: "python setup.py develop && nosetests -w tests/" 
+2

更好地使用'{} envpython setup.py develop',因为它总是会使用正确的可执行文件为每个环境。 – Bengt

+0

@bengt只支持'tox',但不支持'travis'。 –

相关问题