diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-04-12 20:59:05 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-04-12 20:59:05 +0100 |
commit | 59468a2002aa26808a83fd2fb2db0e4e2c83575f (patch) | |
tree | 14c6d40184d6b2996d8adb368b2e2aef2f8f5bda /cmdtest | |
parent | d340738d97b7dbc2b0a0a30d05c68e85cc6033b5 (diff) | |
download | cmdtest-59468a2002aa26808a83fd2fb2db0e4e2c83575f.tar.gz |
Move cat method to cmdtestlib
Diffstat (limited to 'cmdtest')
-rwxr-xr-x | cmdtest | 12 |
1 files changed, 3 insertions, 9 deletions
@@ -190,7 +190,8 @@ class CommandTester(cliapp.Application): if stderr_diff: errors.append(TestFailure(test, 'stderr diff:\n%s' % stderr_diff)) - expected_exit = int(self.cat(test.exit or '/dev/null').strip() or '0') + contents = cmdtestlib.cat(test.exit or '/dev/null') + expected_exit = int(contents.strip() or '0') if exit != expected_exit: errors.append(TestFailure(test, 'got exit code %s, expected %s' % @@ -204,15 +205,8 @@ class CommandTester(cliapp.Application): return errors - def cat(self, filename): - if os.path.exists(filename): - with open(filename) as f: - return f.read() - else: - return '' - def lines(self, filename): - return self.cat(filename).splitlines() + return cmdtestlib.cat(filename).splitlines() def expand(self, strings): variables = { |