I’m trying to run Travis-CI on a module I’ve made. Nosetests pass on my local machine with flying colors, but for some reason the test.py file is failing to import my project. Below is the full output from 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
Note that Scrappy is the name of my project and that is what’s failing to import.
And here is my .travis.yml file:
language: python
python:
- "2.7"
install: "pip install -r requirements.txt --use-mirrors"
script: "nosetests -w tests/"
Any idea what could be wrong?
Ok, so it turns out that Travis-CI doesn’t do an implicit
developwhen installing the target package.This was fixed by editing the
scriptline in the YAML file to: