Refactor doc to use setdefault
This commit is contained in:
parent
83ab8be5f6
commit
ca2cc3da2a
|
@ -906,10 +906,7 @@ here is a little example implemented via a local plugin:
|
||||||
|
|
||||||
# store test results for each phase of a call, which can
|
# store test results for each phase of a call, which can
|
||||||
# be "setup", "call", "teardown"
|
# be "setup", "call", "teardown"
|
||||||
if your_unique_key not in item.stash:
|
item.stash.setdefault(your_unique_key, {})[rep.when] = rep
|
||||||
item.stash[your_unique_key] = {rep.when: rep.passed}
|
|
||||||
else:
|
|
||||||
item.stash[your_unique_key][rep.when] = rep.passed
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Reference in New Issue