[TIP] Testing from sandbox in the presence of installed versions

skip at pobox.com skip at pobox.com
Sat Jan 22 08:19:00 PST 2011

This is one of those posts where I admit my complete ignorance of the right
way to do things.

I'm one of the SpamBayes developer (the only active one at the moment).
While SpamBayes has a bunch of unit tests I have been remiss in keeping them
in working order.  Today I made a very simple change to the code
(incorporate the Python 2.5 versions of asyncore and asynchat into the
source to avoid the breakage present in the 2.6 versions of those modules)
and want to run the unit tests.  They are failing right and left, in part I
think because the version of SpamBayes which is installed in
.../site-packages is being used instead of the code in my sandbox.

I tried using tox with this simple tox.ini file:

    # content of: tox.ini , put in same dir as setup.py
    envlist = py24,py25,py26,py27

Alas, that didn't help because the installed Pythons' site-packages
directories are still searched for SpamBayes, e.g.:

    pkg_resources.run_script('spambayes==1.1b1', 'sb_imapfilter.py')
      File "/Users/skip/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 489, in run_script
      File "/Users/skip/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/pkg_resources.py", line 1207, in run_script
      File "/Users/skip/local/lib/python2.7/site-packages/spambayes-1.1b1-py2.7.egg/EGG-INFO/scripts/sb_imapfilter.py", line 792, in <module>
        class IMAPFolder(object):
      File "/Users/skip/local/lib/python2.7/site-packages/spambayes-1.1b1-py2.7.egg/EGG-INFO/scripts/sb_imapfilter.py", line 828, in IMAPFolder

Without uninstalling SpamBayes, how do I coax tox into using my sandbox
version of SpamBayes?


Skip Montanaro - skip at pobox.com - http://www.smontanaro.net/

More information about the testing-in-python mailing list