title: pytest - rerun failed test after all other tests
body: <p>In my scenario, I have one test that writes a file, and one (but potentially many more) tests that would want to read that file. I cannot simply extract writing that file to a function/fixture, because it involves some other fixtures that inside are starting some other binary and it that binary that writes that file. So I have a fixture, that checks if the file is already there.</p>
  
  <p>What I tried so far:</p>
  
  <ul>
  <li><a href="https://pypi.org/project/flaky/" rel="noreferrer">flaky</a> and <a href="https://pypi.org/project/pytest-rerunfailures/" rel="noreferrer">pytest-rerunfailures</a> plugins - not suitable, as they both rerun the test instantly on failure (when the file still isn't there), and I want to append it at end of test queue.</li>
  <li>manually modifying the test queue, like this:</li>
  </ul>
  
  <p>...</p>
  
  <pre><code>request.session.items.append(request.node)
  pytest.xfail("file not present yet")
  </code></pre>
  
  <p>this kind of works, but only when I run on single runner (without <a href="https://pypi.org/project/pytest-xdist/" rel="noreferrer">xdist</a>, or turning it on, by passing <code>-n0</code> cli arg,
  in my test report I see something like this:</p>
  
  <pre><code>test_load_file_before_save xfail
  test_save_file PASSED        
  test_load_file PASSED        
  test_load_file_before_save PASSED    
  </code></pre>
  
  <p>when run with xdist, the xfailed test does not get repeated. Anyone know how to proceed? Some way to force xdist refresh the test list?</p>