diff --git a/src/extensions/score_metamodel/BUILD b/src/extensions/score_metamodel/BUILD index 3ddd80e15..64c0ebeb5 100644 --- a/src/extensions/score_metamodel/BUILD +++ b/src/extensions/score_metamodel/BUILD @@ -74,16 +74,41 @@ score_pytest( ) score_pytest( - name = "file_based_tests", - size = "medium", + name = "file_based_tests_architecture", srcs = ["tests/test_rules_file_based.py"], - # All requirements already in the library so no need to have it double - data = glob( - [ - "tests/**/*.rst", - "tests/**/*.yaml", - ], - ) + ["tests/rst/conf.py"], + data = glob(["tests/rst/architecture/*.rst"]) + ["tests/rst/conf.py", "tests/rst/needs.json"], + pytest_config = "//:pyproject.toml", + deps = [":score_metamodel"], +) + +score_pytest( + name = "file_based_tests_attributes", + srcs = ["tests/test_rules_file_based.py"], + data = glob(["tests/rst/attributes/*.rst"]) + ["tests/rst/conf.py", "tests/rst/needs.json"], + pytest_config = "//:pyproject.toml", + deps = [":score_metamodel"], +) + +score_pytest( + name = "file_based_tests_graph", + srcs = ["tests/test_rules_file_based.py"], + data = glob(["tests/rst/graph/*.rst"]) + ["tests/rst/conf.py", "tests/rst/needs.json"], + pytest_config = "//:pyproject.toml", + deps = [":score_metamodel"], +) + +score_pytest( + name = "file_based_tests_id_contains_feature", + srcs = ["tests/test_rules_file_based.py"], + data = glob(["tests/rst/id_contains_feature/*.rst"]) + ["tests/rst/conf.py", "tests/rst/needs.json"], + pytest_config = "//:pyproject.toml", + deps = [":score_metamodel"], +) + +score_pytest( + name = "file_based_tests_options", + srcs = ["tests/test_rules_file_based.py"], + data = glob(["tests/rst/options/*.rst"]) + ["tests/rst/conf.py", "tests/rst/needs.json"], pytest_config = "//:pyproject.toml", deps = [":score_metamodel"], ) diff --git a/src/extensions/score_metamodel/tests/rst/conf.py b/src/extensions/score_metamodel/tests/rst/conf.py index 180333964..5995ab809 100644 --- a/src/extensions/score_metamodel/tests/rst/conf.py +++ b/src/extensions/score_metamodel/tests/rst/conf.py @@ -24,9 +24,10 @@ needs_external_needs = [ { "base_url": "https://eclipse-score.github.io/process_description/main/", - "json_url": "https://eclipse-score.github.io/process_description/main/needs.json", + "json_path": "needs.json", } ] + # We add these suppress_warnings here to ease the load of the warnings # In the future we might want to check if ANY warnings comes in the document # And then ensure that we error, as this could also be parsing errors etc. diff --git a/src/extensions/score_metamodel/tests/rst/needs.json b/src/extensions/score_metamodel/tests/rst/needs.json new file mode 100644 index 000000000..b3f9a83ec --- /dev/null +++ b/src/extensions/score_metamodel/tests/rst/needs.json @@ -0,0 +1,29 @@ +{ + "current_version": "1.0", + "project": "test", + "project_url": "https://eclipse-score.github.io/process_description/main/", + "versions": { + "1.0": { + "needs": { + "doc_getstrt__req__process": { + "docname": "getting_started", + "id": "doc_getstrt__req__process", + "lineno": 1, + "status": "valid", + "title": "Process requirement (stub for tests)", + "type": "doc_req", + "type_name": "doc_req" + }, + "gd_guidl__req__engineering": { + "docname": "guidelines", + "id": "gd_guidl__req__engineering", + "lineno": 1, + "status": "valid", + "title": "Engineering guideline requirement (stub for tests)", + "type": "gd_req", + "type_name": "gd_req" + } + } + } + } +} diff --git a/src/extensions/score_metamodel/tests/test_rules_file_based.py b/src/extensions/score_metamodel/tests/test_rules_file_based.py index b80527446..4b0f47b72 100644 --- a/src/extensions/score_metamodel/tests/test_rules_file_based.py +++ b/src/extensions/score_metamodel/tests/test_rules_file_based.py @@ -31,6 +31,7 @@ def sphinx_base_dir(tmp_path_factory: pytest.TempPathFactory) -> Path: ### Create a temporary directory for Sphinx and copy all necessary files. base_dir: Path = tmp_path_factory.mktemp("docs") shutil.copy(RST_DIR / "conf.py", base_dir) + shutil.copy(RST_DIR / "needs.json", base_dir) return base_dir