[Patchew-devel] [PATCH] testcases: use relative imports

Fam Zheng famz at redhat.com
Mon Jul 2 08:11:47 UTC 2018


On Mon, 06/25 10:58, Paolo Bonzini wrote:
> The actual path to patchewtest is tests.patchewtest, so "from patchewtest"
> is strictly speaking incorrect.

This doesn't apply any more?

Fam

> 
> Signed-off-by: Paolo Bonzini <pbonzini at redhat.com>
> ---
>  tests/test_diff.py    | 2 +-
>  tests/test_git.py     | 2 +-
>  tests/test_import.py  | 2 +-
>  tests/test_mbox.py    | 2 +-
>  tests/test_message.py | 2 +-
>  tests/test_model.py   | 2 +-
>  tests/test_project.py | 2 +-
>  tests/test_rest.py    | 2 +-
>  tests/test_tags.py    | 2 +-
>  tests/test_testing.py | 2 +-
>  10 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/tests/test_diff.py b/tests/test_diff.py
> index 735c4e7..28737ed 100755
> --- a/tests/test_diff.py
> +++ b/tests/test_diff.py
> @@ -11,7 +11,7 @@
>  import sys
>  import os
>  sys.path.append(os.path.dirname(__file__))
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  
>  class DiffTest(PatchewTestCase):
>  
> diff --git a/tests/test_git.py b/tests/test_git.py
> index 509949a..ae13f60 100755
> --- a/tests/test_git.py
> +++ b/tests/test_git.py
> @@ -11,7 +11,7 @@
>  import sys
>  import os
>  sys.path.append(os.path.dirname(__file__))
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  import shutil
>  import subprocess
>  from api.models import Message, Result
> diff --git a/tests/test_import.py b/tests/test_import.py
> index 3ad7592..e5735fd 100755
> --- a/tests/test_import.py
> +++ b/tests/test_import.py
> @@ -11,7 +11,7 @@
>  import sys
>  import os
>  sys.path.append(os.path.dirname(__file__))
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  import json
>  from api.models import Message, Project
>  
> diff --git a/tests/test_mbox.py b/tests/test_mbox.py
> index b63608d..89b707b 100755
> --- a/tests/test_mbox.py
> +++ b/tests/test_mbox.py
> @@ -12,7 +12,7 @@ import os
>  import sys
>  import mbox
>  sys.path.append(os.path.dirname(__file__))
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  
>  class MboxTest(PatchewTestCase):
>  
> diff --git a/tests/test_message.py b/tests/test_message.py
> index 8f2f75e..3fa06f5 100755
> --- a/tests/test_message.py
> +++ b/tests/test_message.py
> @@ -10,7 +10,7 @@
>  
>  import time
>  import datetime
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  
>  class ProjectTest(PatchewTestCase):
>  
> diff --git a/tests/test_model.py b/tests/test_model.py
> index 30cb409..6231217 100755
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -8,7 +8,7 @@
>  # This work is licensed under the MIT License.  Please see the LICENSE file or
>  # http://opensource.org/licenses/MIT.
>  
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  from api.models import Message
>  
>  class ImportTest(PatchewTestCase):
> diff --git a/tests/test_project.py b/tests/test_project.py
> index eb06050..2fd6cbe 100755
> --- a/tests/test_project.py
> +++ b/tests/test_project.py
> @@ -8,7 +8,7 @@
>  # This work is licensed under the MIT License.  Please see the LICENSE file or
>  # http://opensource.org/licenses/MIT.
>  
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  
>  class ProjectTest(PatchewTestCase):
>  
> diff --git a/tests/test_rest.py b/tests/test_rest.py
> index fa10921..5a14ca5 100755
> --- a/tests/test_rest.py
> +++ b/tests/test_rest.py
> @@ -16,7 +16,7 @@ import unittest
>  from django.contrib.auth.models import User
>  
>  sys.path.append(os.path.dirname(__file__))
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  from api.models import Message
>  from api.rest import AddressSerializer
>  from collections import OrderedDict
> diff --git a/tests/test_tags.py b/tests/test_tags.py
> index 8469c42..4f91fb0 100755
> --- a/tests/test_tags.py
> +++ b/tests/test_tags.py
> @@ -11,7 +11,7 @@
>  import sys
>  import os
>  sys.path.append(os.path.dirname(__file__))
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  
>  class ImportTest(PatchewTestCase):
>  
> diff --git a/tests/test_testing.py b/tests/test_testing.py
> index 9e61a45..9fa2e61 100755
> --- a/tests/test_testing.py
> +++ b/tests/test_testing.py
> @@ -13,7 +13,7 @@ import sys
>  import os
>  import subprocess
>  sys.path.append(os.path.dirname(__file__))
> -from patchewtest import PatchewTestCase, main
> +from .patchewtest import PatchewTestCase, main
>  from api.models import Message, Result
>  
>  def create_test(project, name):
> -- 
> 2.17.1
> 
> _______________________________________________
> Patchew-devel mailing list
> Patchew-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/patchew-devel




More information about the Patchew-devel mailing list