* I understand we can't patch sys to set frozen to it, but we should add a cleanup call to restore the absence of this attribute. So, this code:
sys.frozen = True
should be followed by something like:
self.addCleanup(del, sys.frozen)
* Same for this code, we need to restore the env like it was before the test run:
if hasattr(sys, "frozen"): delattr(sys, "frozen")
should migrate to something like:
frozen = getattr(sys, "frozen", None)
if frozen is not None: delattr(sys, "frozen") self.addCleanup(setattr, sys, 'frozen', frozen)
* Unless I'm missing something, there is no need to define the FakeCaller, isn't? The test case base class inherits from a testcase that has the _set_called method defined, so you can replace:
* I understand we can't patch sys to set frozen to it, but we should add a cleanup call to restore the absence of this attribute. So, this code:
sys.frozen = True
should be followed by something like:
* Same for this code, we need to restore the env like it was before the test run:
if hasattr(sys, "frozen"):
delattr( sys, "frozen")
should migrate to something like:
frozen = getattr(sys, "frozen", None)
delattr( sys, "frozen")
self. addCleanup( setattr, sys, 'frozen', frozen)
if frozen is not None:
* Unless I'm missing something, there is no need to define the FakeCaller, isn't? The test case base class inherits from a testcase that has the _set_called method defined, so you can replace:
with:
Also, this code:
can morph into (is easier to read, no need to scroll up to see what does fake_caller is/does):
Thanks!