From e49ced91903d6b4daec4de37b28f42b8a04fdb8f Mon Sep 17 00:00:00 2001 From: JP-Ellis Date: Wed, 15 Nov 2023 17:12:02 +1100 Subject: [PATCH] chore: fix lints Signed-off-by: JP-Ellis --- .gitmodules | 2 +- .../__init__.py | 0 .../conftest.py | 0 .../definition | 0 .../test_v1_consumer.py | 12 +++++++++--- .../util.py | 0 6 files changed, 10 insertions(+), 4 deletions(-) rename tests/v3/{compatibility-suite => compatiblity_suite}/__init__.py (100%) rename tests/v3/{compatibility-suite => compatiblity_suite}/conftest.py (100%) rename tests/v3/{compatibility-suite => compatiblity_suite}/definition (100%) rename tests/v3/{compatibility-suite => compatiblity_suite}/test_v1_consumer.py (98%) rename tests/v3/{compatibility-suite => compatiblity_suite}/util.py (100%) diff --git a/.gitmodules b/.gitmodules index 0242118f44..fa1a87278c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "compatibility-suite"] - path = tests/v3/compatibility-suite/definition + path = tests/v3/compatiblity_suite/definition url = ../pact-compatibility-suite.git diff --git a/tests/v3/compatibility-suite/__init__.py b/tests/v3/compatiblity_suite/__init__.py similarity index 100% rename from tests/v3/compatibility-suite/__init__.py rename to tests/v3/compatiblity_suite/__init__.py diff --git a/tests/v3/compatibility-suite/conftest.py b/tests/v3/compatiblity_suite/conftest.py similarity index 100% rename from tests/v3/compatibility-suite/conftest.py rename to tests/v3/compatiblity_suite/conftest.py diff --git a/tests/v3/compatibility-suite/definition b/tests/v3/compatiblity_suite/definition similarity index 100% rename from tests/v3/compatibility-suite/definition rename to tests/v3/compatiblity_suite/definition diff --git a/tests/v3/compatibility-suite/test_v1_consumer.py b/tests/v3/compatiblity_suite/test_v1_consumer.py similarity index 98% rename from tests/v3/compatibility-suite/test_v1_consumer.py rename to tests/v3/compatiblity_suite/test_v1_consumer.py index 10c9989b61..9807f67cf0 100644 --- a/tests/v3/compatibility-suite/test_v1_consumer.py +++ b/tests/v3/compatiblity_suite/test_v1_consumer.py @@ -342,7 +342,7 @@ def the_following_http_interactions_have_been_defined( converters={"ids": lambda s: list(map(int, s.split(",")))}, target_fixture="srv", ) -def the_mock_server_is_started_with_interactions( +def the_mock_server_is_started_with_interactions( # noqa: C901 ids: list[int], interaction_definitions: dict[int, InteractionDefinition], ) -> Generator[PactServer, Any, None]: @@ -377,7 +377,7 @@ def the_mock_server_is_started_with_interactions( definition.body.string, definition.body.mime_type, ) - else: + elif definition.body.bytes: logging.info( "-> with_binary_file(%s, %s)", truncate(definition.body.bytes), @@ -387,6 +387,9 @@ def the_mock_server_is_started_with_interactions( definition.body.bytes, definition.body.mime_type, ) + else: + msg = "Unexpected body definition" + raise RuntimeError(msg) logging.info("-> will_respond_with(%s)", definition.response) interaction.will_respond_with(definition.response) @@ -406,7 +409,7 @@ def the_mock_server_is_started_with_interactions( definition.response_body.string, definition.response_content, ) - else: + elif definition.response_body.bytes: logging.info( "-> with_binary_file(%s, %s)", truncate(definition.response_body.bytes), @@ -416,6 +419,9 @@ def the_mock_server_is_started_with_interactions( definition.response_body.bytes, definition.response_content, ) + else: + msg = "Unexpected body definition" + raise RuntimeError(msg) with pact.serve(raises=False) as srv: yield srv diff --git a/tests/v3/compatibility-suite/util.py b/tests/v3/compatiblity_suite/util.py similarity index 100% rename from tests/v3/compatibility-suite/util.py rename to tests/v3/compatiblity_suite/util.py