title: pytest issues with a session scoped fixture and asyncio
body: <p>I have multiple test files, each has an async fixture that looks like this:</p>
  <pre><code>
  @pytest.fixture(scope=&quot;module&quot;)
  def event_loop(request):
      loop = asyncio.get_event_loop_policy().new_event_loop()
      yield loop
      loop.close()
  
  
  @pytest.fixture(scope=&quot;module&quot;)
  async def some_fixture():
      return await make_fixture()
  </code></pre>
  <p>I'm using xdist for parallelization. In addition I have this decorator:</p>
  <pre><code>@toolz.curry
  def throttle(limit, f):
      semaphore = asyncio.Semaphore(limit)
  
      @functools.wraps(f)
      async def wrapped(*args, **kwargs):
          async with semaphore:
              return await f(*args, **kwargs)
  
      return wrapped
  </code></pre>
  <p>and I have a function uses it:</p>
  <pre><code>@throttle(10)
  def f():
      ...
  </code></pre>
  <p>Now <code>f</code> is being called from multiple test files, and I'm getting an exception telling me that I can't use the semaphore from different event loops.</p>
  <p>I tried moving to a session-level event loop fixture:</p>
  <pre><code>
  
  @pytest.fixture(scope=&quot;session&quot;, autouse=True)
  def event_loop(request):
      loop = asyncio.get_event_loop_policy().new_event_loop()
      yield loop
      loop.close()
  
  </code></pre>
  <p>But this only gave me:</p>
  <blockquote>
  <p>ScopeMismatch: You tried to access the 'function' scoped fixture 'event_loop' with a 'module' scoped request object, involved factories</p>
  </blockquote>
  <p>Is it even possible to have xdist + async fixture + semaphore working together?</p>