summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--roles/htmlify-logs/library/htmlify.py4
-rw-r--r--roles/htmlify-logs/library/test_htmlify.py7
2 files changed, 6 insertions, 5 deletions
diff --git a/roles/htmlify-logs/library/htmlify.py b/roles/htmlify-logs/library/htmlify.py
index a97b9b9..2b02f0c 100644
--- a/roles/htmlify-logs/library/htmlify.py
+++ b/roles/htmlify-logs/library/htmlify.py
@@ -85,8 +85,8 @@ highlight_by_hash();
85 85
86def run(inpath, outpath): 86def run(inpath, outpath):
87 if inpath.endswith('.gz'): 87 if inpath.endswith('.gz'):
88 infile = gzip.open(inpath, 'r') 88 infile = gzip.open(inpath, 'rt')
89 outfile = gzip.open(outpath, 'w') 89 outfile = gzip.open(outpath, 'wt')
90 else: 90 else:
91 infile = open(inpath, 'r') 91 infile = open(inpath, 'r')
92 outfile = open(outpath, 'w') 92 outfile = open(outpath, 'w')
diff --git a/roles/htmlify-logs/library/test_htmlify.py b/roles/htmlify-logs/library/test_htmlify.py
index a9abebc..16aef34 100644
--- a/roles/htmlify-logs/library/test_htmlify.py
+++ b/roles/htmlify-logs/library/test_htmlify.py
@@ -28,9 +28,9 @@ FIXTURE_DIR = os.path.join(os.path.dirname(__file__),
28 28
29class TestHTMLify(testtools.TestCase): 29class TestHTMLify(testtools.TestCase):
30 30
31 def _test_file(self, fn): 31 def _test_file(self, fn, ref_fn):
32 in_path = os.path.join(FIXTURE_DIR, 'in', fn) 32 in_path = os.path.join(FIXTURE_DIR, 'in', fn)
33 ref_path = os.path.join(FIXTURE_DIR, 'reference', fn) 33 ref_path = os.path.join(FIXTURE_DIR, 'reference', ref_fn)
34 out_root = self.useFixture(fixtures.TempDir()).path 34 out_root = self.useFixture(fixtures.TempDir()).path
35 out_path = os.path.join(out_root, fn) 35 out_path = os.path.join(out_root, fn)
36 run(in_path, out_path) 36 run(in_path, out_path)
@@ -45,4 +45,5 @@ class TestHTMLify(testtools.TestCase):
45 self.assertEqual(reference_data, generated_data) 45 self.assertEqual(reference_data, generated_data)
46 46
47 def test_htmlify(self): 47 def test_htmlify(self):
48 self._test_file('job-output.txt') 48 self._test_file('job-output.txt', 'job-output.txt')
49 self._test_file('job-output.txt.gz', 'job-output.txt')