def test_working_directory_shell(self): cache = ProgramOutputCache() cwd = os.path.join(self.tmpdir, 'wd') os.mkdir(cwd) cwd = os.path.realpath(os.path.normpath(str(cwd))) cmd = Command('echo $PWD', working_directory=cwd, shell=True) self.assert_cache(cache, cmd, cwd)
def test_working_directory(self): cache = ProgramOutputCache() cwd = os.path.join(self.tmpdir, 'wd') os.mkdir(cwd) cwd = os.path.realpath(os.path.normpath(str(cwd))) cmd = ['python', '-c', 'import sys, os; sys.stdout.write(os.getcwd())'] self.assert_cache(cache, Command(cmd, working_directory=cwd), cwd)
def test_nonzero_return_code_shell(self): cache = ProgramOutputCache() cmd = sys.executable + " -c 'import sys; sys.exit(1)'" self.assert_cache(cache, Command(cmd, shell=True), '', returncode=1)
def test_nonzero_return_code(self): cache = ProgramOutputCache() cmd = [sys.executable, '-c', 'import sys; sys.exit(1)'] self.assert_cache(cache, Command(cmd), '', returncode=1)
def test_hidden_standard_error(self): cache = ProgramOutputCache() cmd = [sys.executable, '-c', 'import sys; sys.stderr.write("spam")'] self.assert_cache(cache, Command(cmd, hide_standard_error=True), '')
def test_shell(self): cache = ProgramOutputCache() self.assert_cache(cache, Command(u'echo blök', shell=True), u'blök')
def test_simple(self): cache = ProgramOutputCache() self.assert_cache(cache, Command([u'echo', u'blök']), u'blök')
def pytest_funcarg__cache(request): return ProgramOutputCache()
def pytest_funcarg__cache(request): # pylint: disable=W0613 return ProgramOutputCache()