def test_logfile(self, tmpdir): logfile = StringIO() tcsh('echo line1; echo line2', logfile=logfile) logfile.seek(0) out = logfile.read() outlines = out.strip().splitlines() assert outlines[0].startswith('Tcsh-') assert outlines[1] == '' assert outlines[2] == 'line1' assert outlines[3] == 'line2' assert outlines[4].startswith('Tcsh')
def test_logfile(self, tmpdir): logfile = StringIO() cmd = 'echo line1; echo line2' tcsh(cmd, logfile=logfile) out = logfile.getvalue() outlines = out.strip().splitlines() assert outlines[0].endswith(cmd) assert outlines[1] == '' assert outlines[2] == 'line1' assert outlines[3] == 'line2' assert outlines[4].startswith('Tcsh')
def test_ciao(self): envs = getenv('source /soft/ciao/bin/ciao.csh', shell='tcsh') test_script = ['printenv {}'.format(name) for name in sorted(envs)] outlines = tcsh('\n'.join(test_script), env=envs) assert outlines == [envs[name] for name in sorted(envs)]
def test_ascds(self): envs = getenv('source /home/ascds/.ascrc -r release', shell='tcsh') test_script = ['printenv {}'.format(name) for name in sorted(envs)] outlines = tcsh('\n'.join(test_script), env=envs) assert outlines == [envs[name] for name in sorted(envs)]
def test_env(self): envs = getenv('setenv TEST_ENV_VAR2 "hello"', shell='tcsh') assert envs['TEST_ENV_VAR2'] == 'hello' outlines = tcsh('echo $TEST_ENV_VAR2', env=envs) assert outlines == ['hello']
def test_tcsh(self): outlines = tcsh('echo line1; echo line2') assert outlines == ['line1', 'line2']