[TIP] REG: Reload testcases from the interpreter.

arun kali raja arunsep886 at gmail.com
Wed May 3 11:31:04 PDT 2017


Hi,

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.

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.

I was thinking of using the "pytest_runtest_protocol" 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..

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.

I tried to delete my test package from sys.modules but that too doesnt help.

Any pointers on how to proceed?

I am thinking if i can create a new "item" 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?

Regards
Arun Kaliraja.B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20170504/57d21aad/attachment.htm>


More information about the testing-in-python mailing list