def inline_run(self, *args, **kwargs):
finalizers = []<EOL>try:<EOL><INDENT>mp_run = MonkeyPatch()<EOL>mp_run.setenv("<STR_LIT>", str(self.tmpdir))<EOL>mp_run.setenv("<STR_LIT>", str(self.tmpdir))<EOL>finalizers.append(mp_run.undo)<EOL>orig_warn = AssertionRewritingHook._warn_already_imported<EOL>def revert_warn_already_imported():<EOL><INDENT>AssertionRewritingHook._warn_already_imported = orig_warn<EOL><DEDENT>finalizers.append(revert_warn_already_imported)<EOL>AssertionRewritingHook._warn_already_imported = lambda *a: None<EOL>finalizers.append(self.__take_sys_modules_snapshot().restore)<EOL>finalizers.append(SysPathsSnapshot().restore)<EOL>rec = []<EOL>class Collect(object):<EOL><INDENT>def pytest_configure(x, config):<EOL><INDENT>rec.append(self.make_hook_recorder(config.pluginmanager))<EOL><DEDENT><DEDENT>plugins = kwargs.get("<STR_LIT>") or []<EOL>plugins.append(Collect())<EOL>ret = pytest.main(list(args), plugins=plugins)<EOL>if len(rec) == <NUM_LIT:1>:<EOL><INDENT>reprec = rec.pop()<EOL><DEDENT>else:<EOL><INDENT>class reprec(object):<EOL><INDENT>pass<EOL><DEDENT><DEDENT>reprec.ret = ret<EOL>if ret == EXIT_INTERRUPTED and not kwargs.get("<STR_LIT>"):<EOL><INDENT>calls = reprec.getcalls("<STR_LIT>")<EOL>if calls and calls[-<NUM_LIT:1>].excinfo.type == KeyboardInterrupt:<EOL><INDENT>raise KeyboardInterrupt()<EOL><DEDENT><DEDENT>return reprec<EOL><DEDENT>finally:<EOL><INDENT>for finalizer in finalizers:<EOL><INDENT>finalizer()<EOL><DEDENT><DEDENT>
Run ``pytest.main()`` in-process, returning a HookRecorder.

        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 that run than can be done by matching stdout/stderr from
        :py:meth:`runpytest`.

        :param args: 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