From: Sebastian Wagner Date: Fri, 3 Sep 2021 16:06:34 +0000 (+0200) Subject: qa: tox.ini: verify yaml syntax X-Git-Tag: v17.1.0~923^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7777603e8bb711a723379d04ef23070f55c22feb;p=ceph.git qa: tox.ini: verify yaml syntax Signed-off-by: Sebastian Wagner --- diff --git a/qa/tasks/tests/conftest.py b/qa/tasks/tests/conftest.py new file mode 100644 index 000000000000..7cc617a41321 --- /dev/null +++ b/qa/tasks/tests/conftest.py @@ -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 index 000000000000..d6e0e2640c2d --- /dev/null +++ b/qa/tasks/tests/test_import_yaml.py @@ -0,0 +1,5 @@ +import yaml + + +def test_load_yaml(yaml_file): + yaml.safe_load(open(yaml_file)) diff --git a/qa/tox.ini b/qa/tox.ini index 6d5ae7ecba6b..7fc94eb5a455 100644 --- a/qa/tox.ini +++ b/qa/tox.ini @@ -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