]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/smb: add conftest.py for pytest fixtures, etc.
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 17 Nov 2025 18:04:07 +0000 (13:04 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 9 Dec 2025 21:32:39 +0000 (16:32 -0500)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
qa/workunits/smb/tests/conftest.py [new file with mode: 0644]

diff --git a/qa/workunits/smb/tests/conftest.py b/qa/workunits/smb/tests/conftest.py
new file mode 100644 (file)
index 0000000..dcc8f9e
--- /dev/null
@@ -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)