From: Sebastian Wagner Date: Fri, 24 Apr 2020 09:22:52 +0000 (+0200) Subject: pybind/mgr: Add mgr/progress to mon_command reference X-Git-Tag: v16.1.0~2354^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F33886%2Fhead;p=ceph.git pybind/mgr: Add mgr/progress to mon_command reference Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/progress/__init__.py b/src/pybind/mgr/progress/__init__.py index e3379608af7..3f333e01b27 100644 --- a/src/pybind/mgr/progress/__init__.py +++ b/src/pybind/mgr/progress/__init__.py @@ -1,7 +1,7 @@ import os -if 'UNITTEST' not in os.environ: - from .module import * -else: + +if 'UNITTEST' in os.environ: import tests +from .module import Module diff --git a/src/pybind/mgr/progress/module.py b/src/pybind/mgr/progress/module.py index c37d7f2ce8f..4e2b301890d 100644 --- a/src/pybind/mgr/progress/module.py +++ b/src/pybind/mgr/progress/module.py @@ -21,9 +21,6 @@ ENCODING_VERSION = 2 # keep a global reference to the module so we can use it from Event methods _module = None # type: Optional["Module"] -# if unit test we want MgrModule to be blank -if 'UNITTEST' in os.environ: - MgrModule = object # type: ignore class Event(object): """ diff --git a/src/pybind/mgr/progress/test_progress.py b/src/pybind/mgr/progress/test_progress.py index 52f2ae71663..12a23f4a7ba 100644 --- a/src/pybind/mgr/progress/test_progress.py +++ b/src/pybind/mgr/progress/test_progress.py @@ -126,8 +126,9 @@ class TestModule(object): # bunch of attributes for testing module.PgRecoveryEvent.pg_update = mock.Mock() - self.test_module = module.Module() # so we can see if an event gets created - self.test_module.log = mock.Mock() # we don't need to log anything + module.Module._ceph_get_option = mock.Mock() # .__init__ + module.Module._configure_logging = lambda *args: ... # .__init__ + self.test_module = module.Module('module_name', 0, 0) # so we can see if an event gets created self.test_module.get = mock.Mock() # so we can call pg_update self.test_module._complete = mock.Mock() # we want just to see if this event gets called self.test_module.get_osdmap = mock.Mock() # so that self.get_osdmap().get_epoch() works