]> git.proxmox.com Git - ceph.git/blame - ceph/src/ceph-volume/ceph_volume/tests/conftest.py
update sources to v12.2.1
[ceph.git] / ceph / src / ceph-volume / ceph_volume / tests / conftest.py
CommitLineData
d2e6a577 1import pytest
181888fb 2from ceph_volume.devices.lvm import api
d2e6a577
FG
3
4class Capture(object):
5
6 def __init__(self, *a, **kw):
7 self.a = a
8 self.kw = kw
9 self.calls = []
10
11 def __call__(self, *a, **kw):
12 self.calls.append({'args': a, 'kwargs': kw})
13
14
15@pytest.fixture
16def capture():
17 return Capture()
181888fb
FG
18
19
20@pytest.fixture
21def volumes(monkeypatch):
22 monkeypatch.setattr('ceph_volume.process.call', lambda x: ('', '', 0))
23 volumes = api.Volumes()
24 volumes._purge()
25 return volumes
26
27
28@pytest.fixture
29def volume_groups(monkeypatch):
30 monkeypatch.setattr('ceph_volume.process.call', lambda x: ('', '', 0))
31 vgs = api.VolumeGroups()
32 vgs._purge()
33 return vgs
34
35
36@pytest.fixture
37def is_root(monkeypatch):
38 """
39 Patch ``os.getuid()`` so that ceph-volume's decorators that ensure a user
40 is root (or is sudoing to superuser) can continue as-is
41 """
42 monkeypatch.setattr('os.getuid', lambda: 0)