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 <kchai@redhat.com>
(cherry picked from commit
b0bdbc34147c7e795e1a01cce1197b990c48effb)
Conflicts:
qa/tasks/mgr/dashboard/test_auth.py
qa/tasks/mgr/dashboard/test_cephfs.py
qa/tasks/mgr/dashboard/test_crush_rule.py
qa/tasks/mgr/dashboard/test_host.py
qa/tasks/mgr/dashboard/test_orchestrator.py
qa/tasks/mgr/dashboard/test_user.py: trivial resolutions
import jwt
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class AuthTest(DashboardTestCase):
from contextlib import contextmanager
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class CephfsTest(DashboardTestCase):
import time
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class ClusterConfigurationTest(DashboardTestCase):
import six
-from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JList
+from .helper import DashboardTestCase, JObj, JList
class ECPTest(DashboardTestCase):
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class GaneshaTest(DashboardTestCase):
# -*- 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):
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase, JList, JObj
class HostControllerTest(DashboardTestCase):
# -*- 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):
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__)
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class MonitorTest(DashboardTestCase):
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):
# -*- coding: utf-8 -*-
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase, JObj
+from .helper import DashboardTestCase, JObj
class PerfCountersControllerTest(DashboardTestCase):
import six
import time
-from tasks.mgr.dashboard.helper import DashboardTestCase, JAny, JList, JObj
+from .helper import DashboardTestCase, JAny, JList, JObj
log = logging.getLogger(__name__)
import time
-from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JLeaf, JList
+from .helper import DashboardTestCase, JObj, JLeaf, JList
class RbdTest(DashboardTestCase):
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class RbdMirroringTest(DashboardTestCase):
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class RequestsTest(DashboardTestCase):
import urllib
import six
-from tasks.mgr.dashboard.helper import DashboardTestCase, JObj, JList, JLeaf
+from .helper import DashboardTestCase, JObj, JList, JLeaf
logger = logging.getLogger(__name__)
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class RoleTest(DashboardTestCase):
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):
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class SummaryTest(DashboardTestCase):
from __future__ import absolute_import
-from tasks.mgr.dashboard.helper import DashboardTestCase
+from .helper import DashboardTestCase
class UserTest(DashboardTestCase):