<div dir="auto"><div>Thanks a lot Bruno,<div dir="auto"><br></div><div dir="auto">If thatz the case can i have one module level fixture which calls the </div><span style="font-family:sans-serif">configurationBackup method and for the function level backup instead of writing another fixture can i use the pytest hook </span><br><div class="gmail_extra"><span style="color:rgb(36,39,41);font-family:arial,&quot;helvetica neue&quot;,helvetica,sans-serif;font-size:16.05px">pytest_runtest_call to call the </span><span style="font-family:sans-serif">configurationBackup method.. ?</span></div><div class="gmail_extra" dir="auto"><font face="sans-serif"><br></font></div><div class="gmail_extra" dir="auto"><font face="sans-serif">Which is the correct and advantageous approach? </font></div><div class="gmail_extra" dir="auto"><font face="sans-serif"><br></font></div><div class="gmail_extra" dir="auto"><font face="sans-serif">Regards</font></div><div class="gmail_extra" dir="auto"><font face="sans-serif">Arun kali raja.B<br></font><div class="gmail_quote" dir="auto">On 09-Feb-2017 1:12 AM, &quot;Bruno Oliveira&quot; &lt;<a href="mailto:nicoddemus@gmail.com">nicoddemus@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><div class="quoted-text"><div dir="ltr">On Wed, Feb 8, 2017 at 5:36 PM arun kali raja &lt;<a href="mailto:arunsep886@gmail.com" target="_blank">arunsep886@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto" class="m_-1839986581396927920gmail_msg"><div class="m_-1839986581396927920gmail_msg"><br></div><div dir="auto" class="m_-1839986581396927920gmail_msg"><div class="gmail_extra m_-1839986581396927920gmail_msg" dir="auto"><span style="font-family:sans-serif" class="m_-1839986581396927920gmail_msg">Each of the test.py has its own common_configuration function definition and TCs..(test.py won&#39;t have any class def)</span></div><div class="gmail_extra m_-1839986581396927920gmail_msg" dir="auto"><font face="sans-serif" class="m_-1839986581396927920gmail_msg">😊</font></div><div class="gmail_extra m_-1839986581396927920gmail_msg" dir="auto"><font face="sans-serif" class="m_-1839986581396927920gmail_msg"><br class="m_-1839986581396927920gmail_msg"></font></div><div class="gmail_extra m_-1839986581396927920gmail_msg" dir="auto"><font face="sans-serif" class="m_-1839986581396927920gmail_msg">My Conftest.py will be in BaseFolder/</font></div><div class="gmail_extra m_-1839986581396927920gmail_msg" dir="auto"><font face="sans-serif" class="m_-1839986581396927920gmail_msg"><br class="m_-1839986581396927920gmail_msg"></font></div><div class="gmail_extra m_-1839986581396927920gmail_msg" dir="auto"><font face="sans-serif" class="m_-1839986581396927920gmail_msg">So if these two fixtures would go into the conftest.py can they still call the common_configuration function.?</font></div></div></div></blockquote><div><br></div></div><div>You can use the &quot;request&quot; fixture to obtain the module object and then call the common_configuration from there:</div><div><br></div><div>@pytest.fixture(scope=&#39;module&#39;<wbr>)</div><div>def module_config(request):</div><div>    configurationBackup</div><div>    request.module.common_<wbr>configuration()<br>    yield</div><div>    configurationBackup.finalize<br></div><div><br></div><div>&quot;request.module&quot; here will be each &quot;test.py&quot; module.</div><div><br></div><div>Cheers,</div><div>Bruno.</div></div></div>
</blockquote></div><br></div></div></div>