From 621a6d23ec368b3ca4a94170492c6bf98cdfb93e Mon Sep 17 00:00:00 2001 From: p1c2u Date: Fri, 2 Sep 2022 07:41:38 +0100 Subject: [PATCH] tests mark network --- pyproject.toml | 3 +++ tests/integration/test_shortcuts.py | 12 +++++++----- tests/integration/validation/test_validators.py | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8216ca2..d7c741e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,6 +76,9 @@ addopts = """ --cov-report=term-missing --cov-report=xml """ +markers = [ + "network: marks tests which do need network-enabled environment", +] [tool.black] line-length = 79 diff --git a/tests/integration/test_shortcuts.py b/tests/integration/test_shortcuts.py index ce97340..32767a6 100644 --- a/tests/integration/test_shortcuts.py +++ b/tests/integration/test_shortcuts.py @@ -22,7 +22,7 @@ def test_spec_schema_version_not_detected(self): validate_spec(spec) -class TestValidateSpecUrl: +class TestLocalValidateSpecUrl: def test_spec_schema_version_not_detected(self, factory): spec_path = "data/empty.yaml" spec_url = factory.spec_file_url(spec_path) @@ -31,7 +31,7 @@ def test_spec_schema_version_not_detected(self, factory): validate_spec_url(spec_url) -class TestValidatev2Spec: +class TestLiocalValidatev2Spec: LOCAL_SOURCE_DIRECTORY = "data/v2.0/" @@ -68,7 +68,7 @@ def test_falied(self, factory, spec_file): validate_v2_spec(spec) -class TestValidatev30Spec: +class TestLocalValidatev30Spec: LOCAL_SOURCE_DIRECTORY = "data/v3.0/" @@ -105,7 +105,8 @@ def test_falied(self, factory, spec_file): validate_v30_spec(spec) -class TestValidatev2SpecUrl: +@pytest.mark.network +class TestRemoteValidatev2SpecUrl: REMOTE_SOURCE_URL = ( "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/" @@ -134,7 +135,8 @@ def test_valid(self, spec_file): validate_spec_url_factory(openapi_v2_spec_validator)(spec_url) -class TestValidatev30SpecUrl: +@pytest.mark.network +class TestRemoteValidatev30SpecUrl: REMOTE_SOURCE_URL = ( "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/" diff --git a/tests/integration/validation/test_validators.py b/tests/integration/validation/test_validators.py index ca7264c..21932db 100644 --- a/tests/integration/validation/test_validators.py +++ b/tests/integration/validation/test_validators.py @@ -40,6 +40,7 @@ def test_falied(self, factory, validator_v30, spec_file): validator_v30.validate(spec, spec_url=spec_url) +@pytest.mark.network class TestRemoteOpenAPIv30Validator: REMOTE_SOURCE_URL = ( @@ -67,6 +68,7 @@ def test_valid(self, factory, validator_v30, spec_file): return validator_v30.validate(spec, spec_url=spec_url) +@pytest.mark.network class TestRemoteOpeAPIv31Validator: REMOTE_SOURCE_URL = (