[py-dev] Class instance at module level
Joan Miller
peloko45 at gmail.com
Thu Dec 31 13:25:07 CET 2009
Yes, it was that. Thanks for the fast answer
2009/12/31 holger krekel <holger at merlinux.eu>:
> On Thu, Dec 31, 2009 at 11:58 +0000, Joan Miller wrote:
>> Is pssible to instance a class at module level (setup_module) and that
>> it can be used from a test class?
>
> Do you mean like this:
>
> class MyClass:
> pass
>
> def setup_module(mod):
> mod.myclass = MyClass() # put instance to module globals
>
> class TestHello:
> def test_world(self):
> x = myclass # use module-global myclass instance
> ...
>
> ?
>
> If not, can you provide an example?
>
> cheers,
> holger
>
More information about the Pytest-dev
mailing list