<div dir="ltr"><div>P<span class="gmail_default" style="font-family:monospace,monospace">roblem: for the storage of helper objects that either tackle certain global tracking details or that track information over the testprotocol lifecycle of test items, we use monkeypatchs and generally just munge around in either the pytest config object or item objects.</span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">I would like to propose a new API putting those details into consideration.</span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">  config.get_stash(owner, type=pytest.NamespaceStash) # valid over the pytest session lifetime<br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">  item.get_stash(owner, type=pytest.NamespaceStash) # valid across the run-test protocol cycle of item<br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">Each stash  would be a context manager and construction would get access to both item and config.</span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">This would for example enable to express the junit xml logger object and configuration as <br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">`config.get_stash(__name__, JunitXMlTracker)`<br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">Just as  it would allow other plugin to store node lifecycle related details within the node using a well known mechanism<br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">Incidentally this would also be a good fit for the fixture system and</span></div><div><span class="gmail_default" style="font-family:monospace,monospace">setup-state in general to store information.</span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">The basic assumption being that only the stashes of the items that are currently active are valid, and other stashes are torn down,</span></div><div><span class="gmail_default" style="font-family:monospace,monospace">then fixtures as well as the fixture request would nicely fit that storage mechanism, and would also generalize across the node tree from session down to individual items.</span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">(considering the layout, it might be sensible to even replace config.get_stash with something <br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">like session.get_stash)</span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace">The idea is still rather fuzzy in my head and i would love to di either text based brainstorming on it, or a actual video call.<br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"><br></span></div><div><span class="gmail_default" style="font-family:monospace,monospace"></span>-<span class="gmail_default" style="font-family:monospace,monospace"></span>- <span class="gmail_default" style="font-family:monospace,monospace">Ronny</span><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><pre cols="72">Red Hat GmbH, <a href="http://www.de.redhat.com/" target="_blank">http://www.de.redhat.com/</a>, Registered seat: Grasbrunn, 
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Michael Cunningham, Michael O'Neill, Eric Shander</pre></div></div></div></div>