]>
git.proxmox.com Git - ceph.git/blob - ceph/src/pybind/mgr/dashboard/conftest.py
4 from mock
import Mock
, patch
6 from unittest
.mock
import Mock
, patch
9 class MockRadosError(Exception):
10 def __init__(self
, message
, errno
=None):
11 super(MockRadosError
, self
).__init
__(message
)
15 msg
= super(MockRadosError
, self
).__str
__()
16 if self
.errno
is None:
18 return '[errno {0}] {1}'.format(self
.errno
, msg
)
21 def pytest_configure(config
):
23 'rados': Mock(Error
=MockRadosError
, OSError=MockRadosError
),
28 # we need the following patches to fix the issue of multiple inheritance when
29 # one of the base classes is being mocked.
31 # TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) \
32 # subclass of the metaclasses of all its bases
36 patcher
= patch("ceph_module.BaseMgrStandbyModule", new
=_BaseMgrModule
)
38 patcher
= patch("ceph_module.BaseMgrModule", new
=_BaseMgrModule
)