[TIP] How to use same pytest hook at module and function scopes?
arun kali raja
arunsep886 at gmail.com
Wed Feb 8 11:36:23 PST 2017
I was trying to find out if I can solve it by having a single fixture
itself.. seems like its not possible with a single fixture..
My usecase is a little more complicated..
My test case structure will be
Each of the test.py has its own common_configuration function definition
and TCs..(test.py won't have any class def)
My Conftest.py will be in BaseFolder/
So if these two fixtures would go into the conftest.py can they still call
the common_configuration function.?
On 09-Feb-2017 12:50 AM, "Bruno Oliveira" <nicoddemus at gmail.com> wrote:
On Wed, Feb 8, 2017 at 4:56 PM arun kali raja <arunsep886 at gmail.com> wrote:
> Hi Bruno,
> yeah this will solve the case of calling the fixture(which doesnt do
> function level configuration but rather it takes the backup of certain
> files in the system before the TC executes and restores them to original
> state after the TC is complete) before each TC execution .
> But i need the same to be called before the common_configuration part as
> well like below:
> configurationBackup.finalizer(which is done before common_Configuration)
If I understand your example correctly, you can use two fixtures then:
module_config's "configurationBackup.finalizer" will be called last for the
module, after TC_3's "configurationBackup.finalizer".
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python