<div dir="ltr">Hi,<div><br></div><div>i am trying to implement a functionality in pytest through which user can re-run his testcase once the testcase is completed with some modifcations in his testcases.</div><div><br></div><div>I am trying to do this since i have a many fixtures running before the Testcases and  i dont want to go through the pain of executing all the fixtures when i want to run a failed test case sort.</div><div><br></div><div>I was thinking of using the &quot;<span style="color:rgb(106,106,106);font-weight:bold">pytest_runtest_protocol&quot; </span>hook and since the item object has a runtest method i thought making some changes in my test file will reflect when i do a runtest again..</div><div><br></div><div>But that doesnt seem so. item has a attribute (not a member variable... just a scopeAttr) called module which points to the already compiled code and i am not able to override with my new compiled code.</div><div><br></div><div>I tried to delete my test package from sys.modules but that too doesnt help.</div><div><br></div><div>Any pointers on how to proceed?</div><div><br></div><div>I am thinking if i can create a new &quot;item&quot; object all together.. but can i do it in the middle.. there is a hook called makeitem which creates all these item objects (which is a function Object...) when collecting the testcase itself.. any way to create it in the middle?</div><div><br></div><div>Regards</div><div>Arun Kaliraja.B</div></div>