[Patchew-devel] [PATCH v2] tests: fix test_tags for Python < 3.6

Paolo Bonzini posted 1 patch 6 years ago
tests/test_tags.py | 2 ++
1 file changed, 2 insertions(+)
[Patchew-devel] [PATCH v2] tests: fix test_tags for Python < 3.6
Posted by Paolo Bonzini 6 years ago
Older versions of Python require importing subpackages explicitly;
you cannot just import the parent and look for subpackages using
dot notation.  Fix this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/test_tags.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/test_tags.py b/tests/test_tags.py
index a49a660..075c497 100755
--- a/tests/test_tags.py
+++ b/tests/test_tags.py
@@ -13,6 +13,8 @@ import os
 sys.path.append(os.path.dirname(__file__))
 from tests.patchewtest import PatchewTestCase, main
 import email
+import email.parser
+import email.policy
 from mbox import decode_payload
 
 class ImportTest(PatchewTestCase):
-- 
2.19.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
Re: [Patchew-devel] [PATCH v2] tests: fix test_tags for Python < 3.6
Posted by Caio Carrara 6 years ago
Hi Paolo,

On Tue, Nov 27, 2018 at 07:48:29PM +0100, Paolo Bonzini wrote:
> Older versions of Python require importing subpackages explicitly;
> you cannot just import the parent and look for subpackages using
> dot notation.  Fix this.

Cool! I didn't know that.

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Caio Carrara <ccarrara@redhat.com>

> ---
>  tests/test_tags.py | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tests/test_tags.py b/tests/test_tags.py
> index a49a660..075c497 100755
> --- a/tests/test_tags.py
> +++ b/tests/test_tags.py
> @@ -13,6 +13,8 @@ import os
>  sys.path.append(os.path.dirname(__file__))
>  from tests.patchewtest import PatchewTestCase, main
>  import email
> +import email.parser
> +import email.policy
>  from mbox import decode_payload
>  
>  class ImportTest(PatchewTestCase):
> -- 
> 2.19.1
> 

Thanks,
-- 
Caio Carrara
Software Engineer, Virt Team - Red Hat
ccarrara@redhat.com

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel