[Patchew-devel] [PATCH] Use gzip module

Fam Zheng famz at redhat.com
Thu Mar 29 07:01:58 UTC 2018


On Thu, 03/29 11:25, Shubham Jain wrote:
> 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
>  

Applied, thanks!

Fam




More information about the Patchew-devel mailing list