<div dir="ltr">Hi Arun,<br><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 8, 2017 at 12:22 PM arun kali raja &lt;<a href="mailto:arunsep886@gmail.com">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="ltr" class="gmail_msg"><div class="gmail_msg"><br></div><table style="margin:0px;padding:0px;border:0px;font-size:13px;border-collapse:collapse;color:rgb(36,39,41);font-family:arial,&quot;helvetica neue&quot;,helvetica,sans-serif" class="gmail_msg"><tbody style="margin:0px;padding:0px;border:0px" class="gmail_msg"><tr style="margin:0px;padding:0px;border:0px" class="gmail_msg"><td class="m_158534181183200886gmail-votecell gmail_msg" style="padding:0px 15px 0px 0px;border:0px;vertical-align:top"><br></td><td class="m_158534181183200886gmail-postcell gmail_msg" style="padding:0px;border:0px;vertical-align:top"><div style="margin:0px;padding:0px;border:0px" class="gmail_msg"><div class="m_158534181183200886gmail-post-text gmail_msg" style="margin:0px 0px 5px;padding:0px;border:0px;font-size:15px;width:660px;word-wrap:break-word;line-height:1.3"><p style="margin:0px 0px 1em;padding:0px;border:0px;clear:both" class="gmail_msg">I tried couple of things.</p><ol style="margin:0px 0px 1em 30px;padding:0px;border:0px" class="gmail_msg"><li style="margin:0px 0px 0.5em;padding:0px;border:0px;word-wrap:break-word" class="gmail_msg"><p style="margin:0px;padding:0px;border:0px;clear:both" class="gmail_msg">declaring configurationBackup in conftest.py as a function level fixture)as an autouse fixture). But the problem here is its executed before common_configuration fixture for TC_1</p></li></ol></div></div></td></tr></tbody></table></div></blockquote><div><br></div><div>One way to enforce this order is to make the function-level fixture depend on the module-level fixture (common_configuration?):</div><div><br></div><div>    @pytest.fixture(scope=&#39;module&#39;)</div><div>   <span class="inbox-inbox-Apple-converted-space"> </span>def common_configuration():  <br></div><div>       <span class="inbox-inbox-Apple-converted-space"> </span>...</div><div><br></div><div>   <span class="inbox-inbox-Apple-converted-space"> </span>@pytest.fixture(autouse=True)</div><div>   <span class="inbox-inbox-Apple-converted-space"> </span>def function_level_configuration(common_configuration):</div><div>   <span class="inbox-inbox-Apple-converted-space"> </span>    ...</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><table style="margin:0px;padding:0px;border:0px;font-size:13px;border-collapse:collapse;color:rgb(36,39,41);font-family:arial,&quot;helvetica neue&quot;,helvetica,sans-serif" class="gmail_msg"><tbody style="margin:0px;padding:0px;border:0px" class="gmail_msg"><tr style="margin:0px;padding:0px;border:0px" class="gmail_msg"><td class="m_158534181183200886gmail-postcell gmail_msg" style="padding:0px;border:0px;vertical-align:top"><div style="margin:0px;padding:0px;border:0px" class="gmail_msg"><div class="m_158534181183200886gmail-post-text gmail_msg" style="margin:0px 0px 5px;padding:0px;border:0px;font-size:15px;width:660px;word-wrap:break-word;line-height:1.3"><ol style="margin:0px 0px 1em 30px;padding:0px;border:0px" class="gmail_msg"><li style="margin:0px;padding:0px;border:0px;word-wrap:break-word" class="gmail_msg"><p style="margin:0px 0px 1em;padding:0px;border:0px;clear:both" class="gmail_msg">tried using standar pytest hooks. There is a pytest hook pytest_runtest_call.. i was thinking if i can decorate this hook function with my configurationBackup fixture like this:</p></li></ol>      @pytest.mark.usefixtures(&quot;configurationBackup&quot;)  </div><div class="m_158534181183200886gmail-post-text gmail_msg" style="margin:0px 0px 5px;padding:0px;border:0px;font-size:15px;width:660px;word-wrap:break-word;line-height:1.3">      def pytest_runtest_call(item):</div><div class="m_158534181183200886gmail-post-text gmail_msg" style="margin:0px 0px 5px;padding:0px;border:0px;font-size:15px;width:660px;word-wrap:break-word;line-height:1.3">  <br class="gmail_msg"><p style="margin:0px 0px 1em;padding:0px;border:0px;clear:both" class="gmail_msg">But this also doesnt seem to work... my configurationBackup fixture is not called at all..</p></div></div></td></tr></tbody></table></div></blockquote><div><br></div><div>This is unfortunately a common source of confusion, but &quot;@pytest.mark.usefixtures&quot; only works for test items, not fixtures and hooks. But I believe there&#39;s a note about this in the docs.</div><div><br></div><div>My previous suggestion should work, this kind of dependency between fixtures is common and well supported. If it doesn&#39;t, it means I probably didn&#39;t understand your problem completely, in which case I would ask to post a more detailed pseudo-code which better conveys the problem.</div><div><br></div><div><div>Hope this helps,</div><div>Bruno.</div></div></div></div>