From 7378a0c729b36c0ae450589b3b2efec4018623c6 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Fri, 24 Apr 2020 11:22:52 +0200 Subject: [PATCH] pybind/mgr: Add mgr/progress to mon_command reference Signed-off-by: Sebastian Wagner --- src/pybind/mgr/progress/__init__.py | 6 +++--- src/pybind/mgr/progress/module.py | 3 --- src/pybind/mgr/progress/test_progress.py | 5 +++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/pybind/mgr/progress/__init__.py b/src/pybind/mgr/progress/__init__.py index e3379608af76..3f333e01b276 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 c37d7f2ce8fd..4e2b301890db 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 52f2ae716637..12a23f4a7bae 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 -- 2.47.3