nosetest mangles sys.path?

September 13, 2008 – 16:51

Struggling for a second hour in a row. Feeling dumber with every minute spent.

Code:

import pprint
import sys
import django.conf
assert django.conf.__file__.startswith(
    '/home/akhavr'
    ), pprint.pformat((sys.path, django.conf.__file__))

Test run:

PYTHONPATH=/home/akhavr/src/django-hotclub:/home/akhavr/django/:/home/akhavr/src/django-hotclub/apps:/home/akhavr/src/django-hotclub/site-packages/misc:/home/akhavr/src/django-hotclub/site-packages/python-openid-2.1.1:/home/akhavr/src/django-hotclub/site-packages/python-yadis-1.1.0:/home/akhavr/src/django-hotclub/site-packages/python-twitter-0.5/:/home/akhavr/src/django-hotclub/site-packages/pownce-api-0.2:.. DJANGO_SETTINGS_MODULE=pinax.settings nosetests --with-coverage --cover-package=projects --exe -x  projects
F
======================================================================
FAIL: Failure: AssertionError ((['/home/akhavr/src/django-hotclub/pinax/local_apps/projects/tests',
  '/usr/bin',
  '/usr/lib/python2.5/site-packages/coverage-2.78-py2.5.egg',
  '/usr/lib/python2.5/site-packages/twill-0.9-py2.5.egg',
  '/usr/lib/python2.5/site-packages/opml-0.5-py2.5.egg',
  '/usr/lib/python2.5/site-packages/geopy-0.93-py2.5.egg',
  '/usr/lib/python2.5/site-packages/PyCAPTCHA-0.4-py2.5.egg',
  '/usr/lib/python2.5/site-packages/flickrapi-1.1-py2.5.egg',
  '/usr/lib/python2.5/site-packages/simplejson-1.9.1-py2.5-linux-i686.egg',
  '/usr/lib/python2.5/site-packages/httplib2-0.4.0-py2.5.egg',
  '/usr/lib/python2.5/site-packages/icalendar-1.2-py2.5.egg',
  '/usr/lib/python2.5/site-packages/CouchDB-0.5dev_r88-py2.5.egg',
  '/usr/lib/python2.5/site-packages/django_mptt-0.2.1-py2.5.egg',
  '/home/akhavr/src/django-hotclub',
  '/home/akhavr/django',
  '/home/akhavr/src/django-hotclub/apps',
  '/home/akhavr/src/django-hotclub/site-packages/misc',
  '/home/akhavr/src/django-hotclub/site-packages/python-openid-2.1.1',
  '/home/akhavr/src/django-hotclub/site-packages/python-yadis-1.1.0',
  '/home/akhavr/src/django-hotclub/site-packages/python-twitter-0.5',
  '/home/akhavr/src/django-hotclub/site-packages/pownce-api-0.2',
  '/home/akhavr/src/django-hotclub/pinax/local_apps',
  '/usr/lib/python25.zip',
  '/usr/lib/python2.5',
  '/usr/lib/python2.5/plat-linux2',
  '/usr/lib/python2.5/lib-tk',
  '/usr/lib/python2.5/lib-dynload',
  '/usr/lib/python2.5/site-packages',
  '/usr/lib/python2.5/site-packages/Numeric',
  '/usr/lib/python2.5/site-packages/PIL',
  '/usr/lib/python2.5/site-packages/gtk-2.0',
  '/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode'],
 '/usr/lib/python2.5/site-packages/django/conf/__init__.pyc'))

Why sys.path is ignored and django is loaded from the site-packages instead of my ~/src snapshot is beyond my understanding now.

  • Jan

    hmm, Pownce API and CouchDB. I wonder what you are up do :)

    Cheers

    Jan

  • Andrey Khavryuchenko

    Jan:

    Currently – just to run the tests on django-hotclub.

    Further?.. Who knows? ;) Watch the blog? :)