summaryrefslogtreecommitdiff
path: root/tests/test_log.py
diff options
context:
space:
mode:
authorjquast <contact@jeffquast.com>2013-09-22 14:56:58 -0700
committerjquast <contact@jeffquast.com>2013-09-22 14:56:58 -0700
commitf8fd443988d4a5ccfe55538b3d75c92b26651a14 (patch)
treee736cde88cf05921b4dc302d80bf0af6b7ae80dc /tests/test_log.py
parente865d6d43585646dea64f8bae5e1d034c4e7e6e4 (diff)
downloadpexpect-f8fd443988d4a5ccfe55538b3d75c92b26651a14.tar.gz
smartly use .replace & remove 'io' dep. for py2
here goes backwards compatibility testing for py2 versions -- though I have them all locally, trying for travis CI which would help identify problems going forward. I'm sure there is some six.PY3 things to work out yet, already noticed I need a from __future__ import for the 'with' contextmanager for python 2.5.
Diffstat (limited to 'tests/test_log.py')
-rwxr-xr-xtests/test_log.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/tests/test_log.py b/tests/test_log.py
index debdccf..d0d148a 100755
--- a/tests/test_log.py
+++ b/tests/test_log.py
@@ -57,8 +57,7 @@ class TestCaseLog(PexpectTestCase.PexpectTestCase):
with open(filename, 'rb') as f:
lf = f.read()
os.unlink (filename)
- if lf.endswith(_CAT_EOF):
- lf = lf[:-len(_CAT_EOF)]
+ lf = lf.replace(_CAT_EOF, b'')
self.assertEqual(lf, b'This is a test.\r\nThis is a test.\r\n')
def test_log_logfile_send (self):
@@ -98,9 +97,7 @@ class TestCaseLog(PexpectTestCase.PexpectTestCase):
with open(filename, 'rb') as f:
lf = f.read()
os.unlink(filename)
- lf = lf.replace(b'\x04', b'')
- if lf.endswith(_CAT_EOF):
- lf = lf[:-len(_CAT_EOF)]
+ lf = lf.replace(b'\x04', b'').replace(_CAT_EOF, b'')
self.assertEqual(lf,
b'This is a test.\nThis is a test.\r\nThis is a test.\r\n')