Insane import behaviour and regrtest.py: heeelp

John J. Lee jjl at pobox.com
Sun Feb 6 09:16:35 EST 2005


Nick Coghlan <ncoghlan at iinet.net.au> writes:

> John J. Lee wrote:
> > The only change I made to regrtest other than the print statements was
> > to add Lib to sys.path, so I pick up modules from CVS instead of the
> > installed 2.4 versions (yeah, I know I should build and install a
> > python2.5 executable from CVS, but I don't see how that's relevant here).
> 
> I didn't read your whole message so I may be off track here, but
> regrtest.py has some arguably demented path handling behaviour, and
> it's driven mainly by the physical location of regrtest.py. In
> particular:
> 
> def findtestdir():
>      if __name__ == '__main__':
>          file = sys.argv[0]
>      else:
>          file = __file__
>      testdir = os.path.dirname(file) or os.curdir
>      return testdir
> 
> So intead of adding anything to sys.path, tweak the call to 'main' on
> the final line to set "testdir" appropriately.

Nope: that just affects finding the *names* of the tests.  It does not
determine the location from which they are actually imported.  I tried
it, and I get the same results as before (the test modules from my
installed copy of Python are picked up instead of the local copies in
my CVS checkout's Lib/test, apparently entirely contrary to sys.path).


John



More information about the Python-list mailing list