<div dir="auto">Thanks for the feedback. I was unfamiliar with concurrent module (Except for this project i&#39;m stuck on py2).<div dir="auto"><br></div><div dir="auto">After reading the python docs and using your plan it was straight forward to go from a fully setup fixture to a future and setup fixtures in //.</div></div><div class="gmail_extra"><br><div class="gmail_quote">Op 24 nov. 2017 10:19 schreef &quot;Bruno Oliveira&quot; &lt;<a href="mailto:nicoddemus@gmail.com">nicoddemus@gmail.com</a>&gt;:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Wouter,</div><div><br></div>As Ronny said, it is currently impossible for pytest to do this for you automatically, but I believe it is possible to accomplish that with some work yourself:<div><br></div><div>1. Create a session-scoped fixture which returns a concurrent.futures.<wbr>ThreadPoolExecutor.</div><div>2. Modify each fixture which you want to run in parallel to receive the executor, and instead of doing its work directly into the body of the fixture, move that to a function and post the function to the executor. Return the Future object.</div><div>3. Each function which uses one of the fixtures in parallel will have to be modified to deal with a Future object.<br></div><div><br></div><div>Hope that helps,</div><div>Bruno</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 24, 2017 at 5:32 AM RonnyPfannschmidt &lt;<a href="mailto:opensource@ronnypfannschmidt.de" target="_blank">opensource@ronnypfannschmidt.<wbr>de</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <p>Hi Wouter,</p>
    <p><br>
    </p>
    <p>currently there is no way to do fixture setup in parallel and
      also no underlying structure to implement concurrent and/or
      parallel fixture creation.<br>
      enabling something like it is no easy feat and requires a major
      rework of the internals of the pytest fixture system.</p>
    <p><br>
    </p>
    <p>-- Ronny<br>
    </p></div><div text="#000000" bgcolor="#FFFFFF">
    <p><br>
    </p>
    <br>
    <div class="m_2769898577333030619m_2934074541029714842moz-cite-prefix">Am 24.11.2017 um 08:02 schrieb Wouter
      Overmeire:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <div>Hi,</div>
        <div><br>
        </div>
        <div>Is there a way in pytest (or a plugin) to setup test
          fixtures in parallel?</div>
        <div>Not running the tests in // but only setup the fixtures in
          //.</div>
        <div><br>
        </div>
        <div>Suppose I have a number of tests and each have a different
          number of fixtures.</div>
        <div>The fixtures take long to setup, given they are independent
          of each other and not cpu limited, setup could be done in //.</div>
        <div><br>
        </div>
        <div>I prefer not to stuff all fixtures in one major fixture and
          control from this one how to build.</div>
        <div>Not all tests use the same fixtures, and fixtures come and
          go. Ideally I`m looking for a way to add additional decorator
          (or arg on existing fixture pytest decorator) on a fixture
          indicating it can be setup in //.</div>
        <div><br>
        </div>
        <div>I`m familiar with the concept of scope on fixtures, but
          even for session scoped fixtures I would like to setup them in
          //.</div>
        <div><br>
        </div>
        <div>Probably not so trivial given fixtures can be hierarchical.</div>
        <div><br>
        </div>
        <div>The hook pytest_fixture_setup looks the way to go, I`m
          wondering how to run rest of the fixture setup chain in a
          thread and return the fixture when done, This feels like
          breaking the api model behind hooks, given return value of
          hook determines to stop the chain. Not modify rest of the call
          chain.<br>
        </div>
        <div><br>
        </div>
        <div>Wouter</div>
      </div>
      <br>
      <fieldset class="m_2769898577333030619m_2934074541029714842mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
testing-in-python mailing list
<a class="m_2769898577333030619m_2934074541029714842moz-txt-link-abbreviated" href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.<wbr>org</a>
<a class="m_2769898577333030619m_2934074541029714842moz-txt-link-freetext" href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/<wbr>listinfo/testing-in-python</a>
</pre>
    </blockquote>
    <br>
  </div>

______________________________<wbr>_________________<br>
testing-in-python mailing list<br>
<a href="mailto:testing-in-python@lists.idyll.org" target="_blank">testing-in-python@lists.idyll.<wbr>org</a><br>
<a href="http://lists.idyll.org/listinfo/testing-in-python" rel="noreferrer" target="_blank">http://lists.idyll.org/<wbr>listinfo/testing-in-python</a><br>
</blockquote></div>
</blockquote></div></div>