Insane import behaviour and regrtest.py: heeelp

Nick Coghlan ncoghlan at iinet.net.au
Sat Feb 5 22:03:52 EST 2005


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.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list