summaryrefslogtreecommitdiff
path: root/cmdtestlib.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-04-12 20:59:05 +0100
committerLars Wirzenius <liw@liw.fi>2012-04-12 20:59:05 +0100
commit59468a2002aa26808a83fd2fb2db0e4e2c83575f (patch)
tree14c6d40184d6b2996d8adb368b2e2aef2f8f5bda /cmdtestlib.py
parentd340738d97b7dbc2b0a0a30d05c68e85cc6033b5 (diff)
downloadcmdtest-59468a2002aa26808a83fd2fb2db0e4e2c83575f.tar.gz
Move cat method to cmdtestlib
Diffstat (limited to 'cmdtestlib.py')
-rw-r--r--cmdtestlib.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmdtestlib.py b/cmdtestlib.py
index 59a3879..460ab16 100644
--- a/cmdtestlib.py
+++ b/cmdtestlib.py
@@ -20,6 +20,15 @@ __version__ = '0.3'
import os
+def cat(filename):
+ '''Return contents of file, or empty string if it doesn't exist.'''
+ if os.path.exists(filename):
+ with open(filename) as f:
+ return f.read()
+ else:
+ return ''
+
+
class TestCase(object):
def __init__(self, name, path_prefix):