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>
if 'UNITTEST' in os.environ:
import tests
- tests.mock_ceph_modules() # type: ignore
from .module import CephadmOrchestrator
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
if 'UNITTEST' in os.environ:
import tests
- tests.mock_ceph_modules() # type: ignore
from .module import MDSAutoscaler
'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