problem running test file

11 views
Skip to first unread message

Christopher Lee

unread,
Aug 7, 2010, 1:56:11 PM8/7/10
to Pygr Development Group
Hi,
I just ran into an annoying problem trying to run an individual test file. It seems we have broken the ability to run tests one file at a time using PYTHONPATH to supply the location of the pygr libraries. Say I want to run the tests from a specific library directory, e.g.

Administrators-Computer-5:pygr leec$ export PYTHONPATH=~/projects/pygr/build/lib.macosx-10.6-i386-2.6

If I run
python2.6 runtests.py
it dies because it insists on trying to use the source directory instead of my PYTHONPATH. However, I can instead run it with the -b option to make it figure out the right build/lib... directory automatically. That works.

However, if I try to run a single test file, I hit a catch-22. If I don't give the -b flag, it dies because it insists on using the source directory:

Administrators-Computer-5:tests leec$ python2.6 worldbase_test.py
worldbase_test.py:2: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
INFO pathfix.<module>: importing pygr from /Users/leec/projects/pygr/pygr/__init__.pyc

Importing pygr from source directory /Users/leec/projects/pygr

Error: 'cannot import name cnestedlist'

But if I do give the -b flag, now it dies because the individual test file doesn't recognize that as an acceptable option:

Administrators-Computer-5:tests leec$ python2.6 worldbase_test.py -b
worldbase_test.py:2: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
INFO pathfix.<module>: importing pygr from /Users/leec/projects/pygr/build/lib.macosx-10.6-i386-2.6/pygr/__init__.py
option -b not recognized
Usage: worldbase_test.py [options] [test] [...]

I see two problems here:

- a developer should always have the ability to override the default testing paths, and PYTHONPATH is the standard way to do it. That should always work, and it certainly used to work -- I frequently ran individual test files that way. The current version of tests/testlib/pathfix.py has broken this.

- it seems we need to unify command line option processing for individual test files like worldbase_test.py with testlib/testoptions.py

Testing gods (Titus), what do you recommend?

-- Chris

Reply all
Reply to author
Forward
0 new messages