'Run pytest using pexpect.
This makes sure to use the right pytest and sets up the
temporary directory locations.
The pexpect child is returned.'

def spawn_pytest(self, string, expect_timeout=10.0):

    basetemp = self.tmpdir.mkdir('pexpect')
    invoke = '    '.join(map(str, self._getpytestargs()))
    cmd = ('%s    --basetemp=%s    %s' % (invoke, basetemp, string))
    return self.spawn(cmd, expect_timeout=expect_timeout)
