From: John Mulligan Date: Mon, 17 Nov 2025 18:04:07 +0000 (-0500) Subject: qa/workunits/smb: add conftest.py for pytest fixtures, etc. X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=50a9ac0872196ad0d361c4d80c5e72e66973bdfc;p=ceph.git qa/workunits/smb: add conftest.py for pytest fixtures, etc. Signed-off-by: John Mulligan --- diff --git a/qa/workunits/smb/tests/conftest.py b/qa/workunits/smb/tests/conftest.py new file mode 100644 index 000000000000..dcc8f9e99c7e --- /dev/null +++ b/qa/workunits/smb/tests/conftest.py @@ -0,0 +1,32 @@ +import json +import os + +import pytest + +from smbutil import SMBTestConf + + +def read_smb_test_meta(conf_file=None): + if not conf_file: + conf_file = os.environ.get('SMB_TEST_META') + if not conf_file: + return None + with open(conf_file) as fh: + json_data = json.load(fh) + return SMBTestConf(json_data) + + +@pytest.fixture +def smb_cfg(): + conf = read_smb_test_meta() + if not conf: + pytest.skip('no SMB_TEST_META value') + return conf + + +def pytest_generate_tests(metafunc): + if 'share_name' in metafunc.fixturenames: + conf = read_smb_test_meta() + if not conf: + return + metafunc.parametrize('share_name', conf.shares)