From: Kefu Chai Date: Thu, 26 Mar 2020 06:33:06 +0000 (+0800) Subject: qa/tasks/mgr: partial revert of 'import with full path' X-Git-Tag: v16.1.0~2776^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F34195%2Fhead;p=ceph.git qa/tasks/mgr: partial revert of 'import with full path' this change partially reverts #34139 using relative import helps with readability and ease the pain to write down the full parent module name in #34139, all relative imports were replaced with full path, because we were using following code to verify if the code is python3 compatible: ``` mod_spec = importlib.util.spec_from_file_location(mod_name, path) mod = importlib.util.module_from_spec(mod_spec) mod_spec.loader.exec_module(mod) ``` but this does not work with submodule which can import using relative import without specifying the name of the package and its parent module. Signed-off-by: Kefu Chai --- diff --git a/qa/tasks/mgr/dashboard/test_auth.py b/qa/tasks/mgr/dashboard/test_auth.py index 468fe379641c..e76708a9c43b 100644 --- a/qa/tasks/mgr/dashboard/test_auth.py +++ b/qa/tasks/mgr/dashboard/test_auth.py @@ -6,7 +6,7 @@ import time import jwt -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JLeaf +from .helper import DashboardTestCase, JObj, JLeaf class AuthTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_cephfs.py b/qa/tasks/mgr/dashboard/test_cephfs.py index 291d4d85c93c..e6594450f714 100644 --- a/qa/tasks/mgr/dashboard/test_cephfs.py +++ b/qa/tasks/mgr/dashboard/test_cephfs.py @@ -4,7 +4,7 @@ from __future__ import absolute_import import six from contextlib import contextmanager -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JList, JLeaf +from .helper import DashboardTestCase, JObj, JList, JLeaf class CephfsTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_cluster_configuration.py b/qa/tasks/mgr/dashboard/test_cluster_configuration.py index 9f134cd876ae..61d18000a45a 100644 --- a/qa/tasks/mgr/dashboard/test_cluster_configuration.py +++ b/qa/tasks/mgr/dashboard/test_cluster_configuration.py @@ -2,7 +2,7 @@ from __future__ import absolute_import import time -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase class ClusterConfigurationTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_crush_rule.py b/qa/tasks/mgr/dashboard/test_crush_rule.py index 33949925bb04..a0bca63ff4a0 100644 --- a/qa/tasks/mgr/dashboard/test_crush_rule.py +++ b/qa/tasks/mgr/dashboard/test_crush_rule.py @@ -4,7 +4,7 @@ from __future__ import absolute_import import six -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JList +from .helper import DashboardTestCase, JObj, JList class CrushRuleTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_erasure_code_profile.py b/qa/tasks/mgr/dashboard/test_erasure_code_profile.py index 8e93c8ec584f..111e37c7e3e6 100644 --- a/qa/tasks/mgr/dashboard/test_erasure_code_profile.py +++ b/qa/tasks/mgr/dashboard/test_erasure_code_profile.py @@ -4,7 +4,7 @@ from __future__ import absolute_import import six -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JList +from .helper import DashboardTestCase, JObj, JList class ECPTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_ganesha.py b/qa/tasks/mgr/dashboard/test_ganesha.py index 0311daddaa60..cd869a00e405 100644 --- a/qa/tasks/mgr/dashboard/test_ganesha.py +++ b/qa/tasks/mgr/dashboard/test_ganesha.py @@ -4,7 +4,7 @@ from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase class GaneshaTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_health.py b/qa/tasks/mgr/dashboard/test_health.py index e7bfb4fabf00..08551e488ab9 100644 --- a/qa/tasks/mgr/dashboard/test_health.py +++ b/qa/tasks/mgr/dashboard/test_health.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase, JAny, JLeaf, JList, JObj +from .helper import DashboardTestCase, JAny, JLeaf, JList, JObj class HealthTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_host.py b/qa/tasks/mgr/dashboard/test_host.py index 407207133e3b..d608dc247ed5 100644 --- a/qa/tasks/mgr/dashboard/test_host.py +++ b/qa/tasks/mgr/dashboard/test_host.py @@ -2,8 +2,8 @@ from __future__ import absolute_import import json -from tasks.mgr.dashboard.helper import DashboardTestCase, JList, JObj -from tasks.mgr.dashboard.test_orchestrator import test_data +from .helper import DashboardTestCase, JList, JObj +from .test_orchestrator import test_data class HostControllerTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_logs.py b/qa/tasks/mgr/dashboard/test_logs.py index 5108161adade..17d5d830c996 100644 --- a/qa/tasks/mgr/dashboard/test_logs.py +++ b/qa/tasks/mgr/dashboard/test_logs.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase, JList, JObj +from .helper import DashboardTestCase, JList, JObj class LogsTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_mgr_module.py b/qa/tasks/mgr/dashboard/test_mgr_module.py index ec6dbb47f862..080b8b64c239 100644 --- a/qa/tasks/mgr/dashboard/test_mgr_module.py +++ b/qa/tasks/mgr/dashboard/test_mgr_module.py @@ -4,7 +4,7 @@ from __future__ import absolute_import import logging import requests -from tasks.mgr.dashboard.helper import DashboardTestCase, JAny, JObj, JList, JLeaf +from .helper import DashboardTestCase, JAny, JObj, JList, JLeaf logger = logging.getLogger(__name__) diff --git a/qa/tasks/mgr/dashboard/test_monitor.py b/qa/tasks/mgr/dashboard/test_monitor.py index 1558cdc82aff..0cf7e25a282a 100644 --- a/qa/tasks/mgr/dashboard/test_monitor.py +++ b/qa/tasks/mgr/dashboard/test_monitor.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase class MonitorTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_orchestrator.py b/qa/tasks/mgr/dashboard/test_orchestrator.py index 4f248a1c3c6b..9f4204379ac9 100644 --- a/qa/tasks/mgr/dashboard/test_orchestrator.py +++ b/qa/tasks/mgr/dashboard/test_orchestrator.py @@ -2,7 +2,7 @@ from __future__ import absolute_import import json -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase test_data = { diff --git a/qa/tasks/mgr/dashboard/test_osd.py b/qa/tasks/mgr/dashboard/test_osd.py index 4f2028d2297e..1bd75e4b0947 100644 --- a/qa/tasks/mgr/dashboard/test_osd.py +++ b/qa/tasks/mgr/dashboard/test_osd.py @@ -4,7 +4,7 @@ from __future__ import absolute_import import json -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JAny, JList, JLeaf, JTuple +from .helper import DashboardTestCase, JObj, JAny, JList, JLeaf, JTuple class OsdTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_perf_counters.py b/qa/tasks/mgr/dashboard/test_perf_counters.py index f1d267ce187d..c3191dc5e941 100644 --- a/qa/tasks/mgr/dashboard/test_perf_counters.py +++ b/qa/tasks/mgr/dashboard/test_perf_counters.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj +from .helper import DashboardTestCase, JObj class PerfCountersControllerTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_pool.py b/qa/tasks/mgr/dashboard/test_pool.py index 327bec6a0c08..969318d2a94b 100644 --- a/qa/tasks/mgr/dashboard/test_pool.py +++ b/qa/tasks/mgr/dashboard/test_pool.py @@ -6,7 +6,7 @@ import six import time from contextlib import contextmanager -from tasks.mgr.dashboard.helper import DashboardTestCase, JAny, JList, JObj +from .helper import DashboardTestCase, JAny, JList, JObj log = logging.getLogger(__name__) diff --git a/qa/tasks/mgr/dashboard/test_rbd.py b/qa/tasks/mgr/dashboard/test_rbd.py index 5d82aa3d18e7..a3ef00b1b7f0 100644 --- a/qa/tasks/mgr/dashboard/test_rbd.py +++ b/qa/tasks/mgr/dashboard/test_rbd.py @@ -5,7 +5,7 @@ from __future__ import absolute_import import time -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JLeaf, JList +from .helper import DashboardTestCase, JObj, JLeaf, JList class RbdTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_rbd_mirroring.py b/qa/tasks/mgr/dashboard/test_rbd_mirroring.py index f8268f3525bf..39e5f895f110 100644 --- a/qa/tasks/mgr/dashboard/test_rbd_mirroring.py +++ b/qa/tasks/mgr/dashboard/test_rbd_mirroring.py @@ -3,7 +3,7 @@ from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase class RbdMirroringTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_requests.py b/qa/tasks/mgr/dashboard/test_requests.py index 22376c0a29b5..0d9f8d9ba836 100644 --- a/qa/tasks/mgr/dashboard/test_requests.py +++ b/qa/tasks/mgr/dashboard/test_requests.py @@ -2,7 +2,7 @@ from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase class RequestsTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_rgw.py b/qa/tasks/mgr/dashboard/test_rgw.py index 0d75e63f5e00..9cb3504b5ae3 100644 --- a/qa/tasks/mgr/dashboard/test_rgw.py +++ b/qa/tasks/mgr/dashboard/test_rgw.py @@ -10,7 +10,7 @@ from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.twofactor.totp import TOTP from cryptography.hazmat.primitives.hashes import SHA1 -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JList, JLeaf +from .helper import DashboardTestCase, JObj, JList, JLeaf logger = logging.getLogger(__name__) diff --git a/qa/tasks/mgr/dashboard/test_role.py b/qa/tasks/mgr/dashboard/test_role.py index d678fa195f55..dbfaea9e4f2d 100644 --- a/qa/tasks/mgr/dashboard/test_role.py +++ b/qa/tasks/mgr/dashboard/test_role.py @@ -2,7 +2,7 @@ from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase class RoleTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_settings.py b/qa/tasks/mgr/dashboard/test_settings.py index 4c6ebeacaaeb..2d890484a3e0 100644 --- a/qa/tasks/mgr/dashboard/test_settings.py +++ b/qa/tasks/mgr/dashboard/test_settings.py @@ -2,7 +2,7 @@ from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase, JList, JObj, JAny +from .helper import DashboardTestCase, JList, JObj, JAny class SettingsTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_summary.py b/qa/tasks/mgr/dashboard/test_summary.py index 808107a3119e..a31f89146736 100644 --- a/qa/tasks/mgr/dashboard/test_summary.py +++ b/qa/tasks/mgr/dashboard/test_summary.py @@ -1,6 +1,6 @@ from __future__ import absolute_import -from tasks.mgr.dashboard.helper import DashboardTestCase +from .helper import DashboardTestCase class SummaryTest(DashboardTestCase): diff --git a/qa/tasks/mgr/dashboard/test_user.py b/qa/tasks/mgr/dashboard/test_user.py index f3606ed85187..ea7beee6d7a5 100644 --- a/qa/tasks/mgr/dashboard/test_user.py +++ b/qa/tasks/mgr/dashboard/test_user.py @@ -6,7 +6,7 @@ import time from datetime import datetime, timedelta -from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JLeaf +from .helper import DashboardTestCase, JObj, JLeaf class UserTest(DashboardTestCase):