diff options
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 = { |