]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: pytest: Unconditionally mock the rados objects
authorSebastian Wagner <sebastian.wagner@suse.com>
Wed, 26 Aug 2020 08:39:20 +0000 (10:39 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Wed, 26 Aug 2020 10:36:18 +0000 (12:36 +0200)
Always call `mock_ceph_modules()`. Otherwise we'd need to
split the tox run between modules that need to call
`mock_ceph_modules()` and those that don't

Fixes: https://tracker.ceph.com/issues/47141
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/__init__.py
src/pybind/mgr/dashboard/__init__.py
src/pybind/mgr/mds_autoscaler/__init__.py
src/pybind/mgr/tests/__init__.py

index 9a9f07432113387d21ad8bf7445371944613b20c..f390f18c16aaacde7e142cd485dacdc48135f23c 100644 (file)
@@ -2,6 +2,5 @@ import os
 
 if 'UNITTEST' in os.environ:
     import tests
-    tests.mock_ceph_modules()  # type: ignore
 
 from .module import CephadmOrchestrator
index 30013bb777102eabc78ab3c194a1496461c00310..548d401238f58d36c0047110586f974162d7e197 100644 (file)
@@ -38,12 +38,10 @@ else:
     os.environ['PATH'] = '{}:{}'.format(os.path.abspath('../../../../build/bin'),
                                         os.environ['PATH'])
 
-    from tests import mock, mock_ceph_modules  # type: ignore
+    from tests import mock  # type: ignore
 
     mgr = mock.Mock()
     mgr.get_frontend_path.side_effect = lambda: os.path.abspath("./frontend/dist")
 
-    mock_ceph_modules()
-
 # DO NOT REMOVE: required for ceph-mgr to load a module
 from .module import Module, StandbyModule  # noqa: F401
index 85a3241266b1f37035840dee938f6432a5ea1b34..326792113f8d182fc8a3c512dd979018e4420e81 100644 (file)
@@ -2,6 +2,5 @@ import os
 
 if 'UNITTEST' in os.environ:
     import tests
-    tests.mock_ceph_modules()  # type: ignore
 
 from .module import MDSAutoscaler
index 7b6fb41b2258a7e0a2e0f88509c7f46d3c7eb496..26354dc2cf57b798fb6fe8f476f66114b748b298 100644 (file)
@@ -189,4 +189,7 @@ if 'UNITTEST' in os.environ:
             'rados': mock.MagicMock(Error=MockRadosError, OSError=MockRadosError),
             'rbd': mock.Mock(),
             'cephfs': mock.Mock(),
-        })
\ No newline at end of file
+        })
+
+    # Unconditionally mock the rados objects when we're imported
+    mock_ceph_modules()  # type: ignore