[Patchew-devel] [PATCH] Use gzip module

Shubham Jain shubhamjain7495 at gmail.com
Thu Mar 29 05:55:05 UTC 2018


In class PatchewTestCase, cat doesn't stat the ".gz" files for MacOS. Changed it to use the gzip module instead of subprocess.
---
 tests/patchewtest.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/patchewtest.py b/tests/patchewtest.py
index 7e51e70..5bed3b9 100644
--- a/tests/patchewtest.py
+++ b/tests/patchewtest.py
@@ -16,6 +16,7 @@ import shutil
 import argparse
 import json
 import atexit
+import gzip
 
 BASE_DIR = os.path.join(os.path.dirname(__file__), "..")
 
@@ -102,7 +103,9 @@ class PatchewTestCase(django.test.LiveServerTestCase):
     def get_data_path(self, fname):
         r = tempfile.NamedTemporaryFile(dir=RUN_DIR, prefix="test-data-", delete=False)
         d = os.path.join(BASE_DIR, "tests", "data", fname)
-        r.write(subprocess.check_output(["zcat", d]))
+        with gzip.open(d, 'rb') as f:
+            file_content = f.read()
+        r.write(file_content)
         r.close()
         return r.name
 
-- 
2.14.3 (Apple Git-98)




More information about the Patchew-devel mailing list