[TIP] How to use same pytest hook at module and function scopes?

Bruno Oliveira nicoddemus at gmail.com
Wed Feb 8 14:13:47 PST 2017

On Wed, Feb 8, 2017 at 6:37 PM arun kali raja <arunsep886 at gmail.com> wrote:

> If thatz the case can i have one module level fixture which calls the
> configurationBackup method and for the function level backup instead of
> writing another fixture can i use the pytest hook
> pytest_runtest_call to call the configurationBackup method.. ?
> Which is the correct and advantageous approach?

IMO it is simpler to have two fixtures; you would have to more obscure code
in `pytest_runtest_call` to accomplish the same thing.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20170208/2160288d/attachment.htm>

More information about the testing-in-python mailing list