On Thu, Nov 16, 2006 at 22:34 +0100, Maciek Fijalkowski wrote: > Pierre Rouleau wrote: > > def setup_module(roman): > > print 'SETTING UP........................' > > > > global knownValues > > knownValues = ( (1, 'I'), > > (2, 'II'), > > (3, 'III'), > > (4, 'IV'), > > (5, 'V'), > > (6, 'VI'), > > (7, 'VII'), > > .... > > > > > > I wanted to know if the values set up by the setup_module function > > would be available to the test functions. [...] > > > Of course tha you just write: > > def setup_module(mod): > mod.some_global_value = whatever_you_like > > :-) It's of course better, because explicit is better than implicit (you > avoid exporting all variables used in setup_)
yes, that is the usual way, but i am not sure why Pierre's code fails, there is no obvious reason, unless the setup_module is actually imported from somewhere else in which case the "test_roman" module source and the setup_module would not share the same "globals" - this is the reason why it is better to use the argument, because you can then share "setup_module" code across various test modules. best, holger _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev