'Return result of running pytest in-process, providing a similar
interface to what self.runpytest() provides.'

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

    if kwargs.get('syspathinsert'):
        self.syspathinsert()
    now = time.time()
    capture = MultiCapture(Capture=SysCapture)
    capture.start_capturing()
    try:
        reprec = self.inline_run(*args, **kwargs)
    except SystemExit as e:
        class reprec:
            ret = e.args[0]
    except Exception:
        traceback.print_exc()
        class reprec:
            ret = 3
    finally:
        (out, err) = capture.readouterr()
        capture.stop_capturing()
        sys.stdout.write(out)
        sys.stderr.write(err)
    res = RunResult(reprec.ret, out.split('\n'), err.split('\n'), (time.time() - now))
    res.reprec = reprec
    return res
