]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: tox.ini: verify yaml syntax 43045/head
authorSebastian Wagner <sewagner@redhat.com>
Fri, 3 Sep 2021 16:06:34 +0000 (18:06 +0200)
committerSebastian Wagner <sewagner@redhat.com>
Tue, 7 Sep 2021 08:20:34 +0000 (10:20 +0200)
Signed-off-by: Sebastian Wagner <sewagner@redhat.com>
qa/tasks/tests/conftest.py [new file with mode: 0644]
qa/tasks/tests/test_import_yaml.py [new file with mode: 0644]
qa/tox.ini

diff --git a/qa/tasks/tests/conftest.py b/qa/tasks/tests/conftest.py
new file mode 100644 (file)
index 0000000..7cc617a
--- /dev/null
@@ -0,0 +1,12 @@
+import glob
+
+
+def pytest_addoption(parser):
+    parser.addoption("--suite-dir", help="suite dir")
+
+def pytest_generate_tests(metafunc):
+    if "yaml_file" in metafunc.fixturenames:
+        suite_dir = metafunc.config.getoption("--suite-dir")
+        files = glob.glob(f"{suite_dir}/**/*.yaml", recursive=True)
+
+        metafunc.parametrize("yaml_file", list(set(files)))
diff --git a/qa/tasks/tests/test_import_yaml.py b/qa/tasks/tests/test_import_yaml.py
new file mode 100644 (file)
index 0000000..d6e0e26
--- /dev/null
@@ -0,0 +1,5 @@
+import yaml
+
+
+def test_load_yaml(yaml_file):
+    yaml.safe_load(open(yaml_file))
index 6d5ae7ecba6b194d9c753b217ce06f931e173dd8..7fc94eb5a455b44af0b1798c1a983db28b109753 100644 (file)
@@ -29,7 +29,7 @@ deps =
   httplib2
 commands =
   pytest --assert=plain test_import.py
-  pytest tasks/tests
+  pytest tasks/tests --suite-dir {toxinidir}/suites {posargs}
 
 [testenv:deadsymlinks]
 basepython = python3