diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index c799228b3..b9ea4cea9 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -77,6 +77,9 @@ jobs: - name: Test with pytest run: | poetry run pytest --cov=./ --cov-report xml + if [[ ${{ matrix.python-version }} == '3.9' ]]; then + poetry run pytest --cov=./ --cov-report xml --cov-append -m slow + fi - name: Upload coverage to Codecov uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0 - name: Save cache diff --git a/annif/openapi/annif.yaml b/annif/openapi/annif.yaml index 117faef9c..09d26a2a0 100644 --- a/annif/openapi/annif.yaml +++ b/annif/openapi/annif.yaml @@ -224,6 +224,7 @@ components: notation: type: string example: "42.42" + nullable: true score: type: number example: 0.85 @@ -246,6 +247,8 @@ components: type: array items: type: object + required: + - uri properties: uri: type: string diff --git a/pyproject.toml b/pyproject.toml index 4c7fb93a9..5a69bc4b1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -91,3 +91,6 @@ build-backend = "poetry.core.masonry.api" profile = "black" line_length = "88" skip_gitignore = true + +[tool.pytest.ini_options] +addopts = "-m 'not slow'" diff --git a/tests/test_openapi.py b/tests/test_openapi.py index e77230fd9..91de50385 100644 --- a/tests/test_openapi.py +++ b/tests/test_openapi.py @@ -1,4 +1,5 @@ """Unit tests for Annif REST API / Swagger spec""" +import pytest import schemathesis from hypothesis import settings @@ -15,3 +16,12 @@ def check_cors(response, case): def test_api(case, app): response = case.call_wsgi(app) case.validate_response(response, additional_checks=(check_cors,)) + + +@pytest.mark.slow +@schema.parametrize(endpoint="/v1/projects/{project_id}") +@settings(max_examples=50) +def test_api_target_dummy_fi(case, app): + case.path_parameters = {"project_id": "dummy-fi"} + response = case.call_wsgi(app) + case.validate_response(response)