Re: [Pyunit-interest] feature and usage questions.
Brought to you by:
purcell
From: Stephen P. <ste...@ya...> - 2000-05-18 04:41:46
|
Shae Erisson wrote: > > yes, this was my problem, I corrected it by downloading the latest > version of PyUnit (oops). Hmmm. Wonder what it was that I changed between releases... > The latest downloadable version of PyUnit doesn't have an addSuite. > > Ah, upon further reading of this email, > alltests.addTest(test_ast.suite()) _does_ work. This is exactly what I > wanted. Sorry; my rushed typo. > [reloading modules] The imported modules list is even easier to get: sys.modules The problem is more complex than that, though. 'reload' only affects the module definition (i.e. implementation) imported into the current namespace, so I have a suspicion that there's an issue with chaining. Imports form a tree structure through all modules, so the order of reloading of modules makes a big difference. Consider modules 'foo' and 'bar' in this session: % cat foo.py version = 1 UNIX % cat bar.py from foo import version % python Python 1.5.2 (#1, Sep 17 1999, 20:15:36) [GCC egcs-2.91.66 19990314/Linux (egcs- on linux-i386 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> import foo,bar >>> foo.version, bar.version (1, 1) >>> f = open('foo.py','w') >>> f.write('version = 2\n') # change foo module >>> f.close() >>> reload(bar) <module 'bar' from 'bar.pyc'> >>> foo.version, bar.version (1, 1) >>> reload(foo) <module 'foo' from 'foo.py'> >>> foo.version, bar.version (2, 1) >>> reload(bar) <module 'bar' from 'bar.pyc'> >>> foo.version, bar.version (2, 2) > It is quite fiddly though :( Hey, *I'd* be disappointed if it wasn't. <grin> -Steve _____________________________________________ Steve Purcell, Technical Director, Inkontact Get in touch at http://www.inkontact.com/ |