title: Accessing Pytest Pass/Fail count (Test stats) from with in code
body: <p>Is there a way to capture the test stats (pass/fail/xfail/skipped) count when invoking pytest from with in python code using </p>
  
  <pre><code>exit_code = pytest.main()
  </code></pre>
  
  <p>Once the pytest is done executing the tests, I would like to collect these stats for further processing. All I could think right now is to write plugin and access "<strong>terminalreporter</strong>" plugins stats, but if there's a better and easy way to do this , I would love to know.</p>