'Run ``pytest.main()`` in-process, returning a HookRecorder.
This runs the :py:func:`pytest.main` function to run all of
pytest inside the test process itself.  This means it can
return a :py:class:`HookRecorder` instance which gives more
detailed results from then run then can be done by matching
stdout/stderr from :py:meth:`runpytest`.
:param args: Any command line arguments to pass to
:py:func:`pytest.main`.
:param plugin: (keyword-only) Extra plugin instances the
``pytest.main()`` instance should use.
:return: A :py:class:`HookRecorder` instance.'

def inline_run(self, *args, **kwargs):

    orig_warn = AssertionRewritingHook._warn_already_imported
    def revert():
        AssertionRewritingHook._warn_already_imported = orig_warn
    self.request.addfinalizer(revert)
    AssertionRewritingHook._warn_already_imported = (lambda *a: None)
    rec = []
    class Collect:
        def pytest_configure(x, config):
            rec.append(self.make_hook_recorder(config.pluginmanager))
    plugins = (kwargs.get('plugins') or [])
    plugins.append(Collect())
    ret = pytest.main(list(args), plugins=plugins)
    self.delete_loaded_modules()
    if (len(rec) == 1):
        reprec = rec.pop()
    else:
        class reprec:
            pass
    reprec.ret = ret
    if ((ret == 2) and (not kwargs.get('no_reraise_ctrlc'))):
        calls = reprec.getcalls('pytest_keyboard_interrupt')
        if (calls and (calls[(-1)].excinfo.type == KeyboardInterrupt)):
            raise KeyboardInterrupt()
    return reprec
