Add a default value to CallInfo.result
This commit is contained in:
1
changelog/3554.bugfix
Normal file
1
changelog/3554.bugfix
Normal file
@@ -0,0 +1 @@
|
||||
Allow CallInfo to have an unfinished state represented by having a None value in the result attribute.
|
||||
@@ -194,6 +194,7 @@ class CallInfo(object):
|
||||
#: "teardown", "memocollect"
|
||||
self.when = when
|
||||
self.start = time()
|
||||
self.result = None
|
||||
try:
|
||||
self.result = func()
|
||||
except KeyboardInterrupt:
|
||||
|
||||
@@ -473,7 +473,7 @@ def test_callinfo():
|
||||
assert "result" in repr(ci)
|
||||
ci = runner.CallInfo(lambda: 0 / 0, "123")
|
||||
assert ci.when == "123"
|
||||
assert not hasattr(ci, "result")
|
||||
assert ci.result is None
|
||||
assert ci.excinfo
|
||||
assert "exc" in repr(ci)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user