From: Alfredo Deza Date: Mon, 24 Sep 2018 14:29:12 +0000 (-0400) Subject: ceph-volume tests reset the cluster name after every unit test X-Git-Tag: v14.0.1~184^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=877ee1a27e0651355812e27fbc6ac0a87ea56a68;p=ceph.git ceph-volume tests reset the cluster name after every unit test Signed-off-by: Alfredo Deza --- diff --git a/src/ceph-volume/ceph_volume/tests/conftest.py b/src/ceph-volume/ceph_volume/tests/conftest.py index 5222b45e76d6..dfa84e567703 100644 --- a/src/ceph-volume/ceph_volume/tests/conftest.py +++ b/src/ceph-volume/ceph_volume/tests/conftest.py @@ -85,6 +85,22 @@ def stub_call(monkeypatch): return apply +@pytest.fixture(autouse=True) +def reset_cluster_name(request, monkeypatch): + """ + The globally available ``ceph_volume.conf.cluster`` might get mangled in + tests, make sure that after evert test, it gets reset, preventing pollution + going into other tests later. + """ + def fin(): + conf.cluster = None + try: + os.environ.pop('CEPH_CONF') + except KeyError: + pass + request.addfinalizer(fin) + + @pytest.fixture def conf_ceph(monkeypatch): """