def run_command(self, code, **kw): with TempDirectory() as dir: self.path = dir.write('test.py', code+'\n') with OutputCapture() as output: result = run([sys.executable, self.path], **kw) output.compare('') return result
def process(self, path): output = run(['crontab', '-l', '-u', self.name]) with open(join(path, self.name), 'w') as stream: stream.write(output)
def test_with_shell(self): with OutputCapture() as output: result = run('echo "hello out there"', shell=True) output.compare('') compare(result, 'hello out there\n')
def process(self, path): output = run([self.name, package_managers[self.name]]) with open(join(path, self.name), 'w') as stream: stream.write(output)
def run_git(self, *args): return run((self.git, )+args, cwd=self.path)
def git(self, command, repo_path=None): return run(["git"] + command.split(), cwd=repo_path or self.dir.path)