diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6789aa1..d1942f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 24.10.0 hooks: - id: black exclude: &exclude | @@ -9,14 +9,14 @@ repos: | ^src/gnmi/proto/_legacy/.* ) - - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.3 + - repo: https://github.com/pycqa/flake8 + rev: 7.1.1 hooks: - id: flake8 exclude: *exclude - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.1.0 + rev: v5.0.0 hooks: - id: trailing-whitespace exclude: *exclude diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 0753684..a3da729 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -49,7 +49,9 @@ def service_unauthenticated(channel) -> gnmi.proto.gNMIStub: @pytest.fixture def service_legacy(target, channel_legacy) -> gnmi.proto.legacy.gNMIStub: - return gnmi.proto.legacy.gNMIStub(channel_legacy,) + return gnmi.proto.legacy.gNMIStub( + channel_legacy, + ) @pytest.fixture diff --git a/tests/integration/test_integration_gnmi.py b/tests/integration/test_integration_gnmi.py index f0407d1..ab6e55d 100644 --- a/tests/integration/test_integration_gnmi.py +++ b/tests/integration/test_integration_gnmi.py @@ -13,6 +13,7 @@ pytestmark = [pytest.mark.asyncio, pytest.mark.integration] + @pytest.fixture def get_request_interfaces() -> gnmi.proto.GetRequest: return gnmi.proto.GetRequest( @@ -20,7 +21,9 @@ def get_request_interfaces() -> gnmi.proto.GetRequest: ) -async def test_integration_permission_denied(service_unauthenticated, get_request_interfaces): +async def test_integration_permission_denied( + service_unauthenticated, get_request_interfaces +): with pytest.raises(grpclib.exceptions.GRPCError) as e: await service_unauthenticated.get(get_request_interfaces) @@ -54,10 +57,14 @@ async def test_integration_update_set_string(service): update = gnmi.proto.Update( path=path, val=gnmi.proto.TypedValue(string_val=new_password) ) - response = await service.set(gnmi.proto.SetRequest(update=[update]),) + response = await service.set( + gnmi.proto.SetRequest(update=[update]), + ) assert isinstance(response, gnmi.proto.SetResponse) - response = await service.get(gnmi.proto.GetRequest(path=path),) + response = await service.get( + gnmi.proto.GetRequest(path=path), + ) validate_response_get(response=response, value=new_password) @@ -67,10 +74,14 @@ async def test_integration_update_set_json(service): update = gnmi.proto.Update( path=path, val=gnmi.proto.TypedValue(json_ietf_val=json.dumps(config).encode()) ) - response = await service.set(gnmi.proto.SetRequest(update=[update]),) + response = await service.set( + gnmi.proto.SetRequest(update=[update]), + ) assert isinstance(response, gnmi.proto.SetResponse) - response = await service.get(gnmi.proto.GetRequest(path=path),) + response = await service.get( + gnmi.proto.GetRequest(path=path), + ) validate_response_get(response=response, value=config) @@ -79,5 +90,7 @@ async def test_integration_delete(service): await service.set(gnmi.proto.SetRequest(delete=[path])) - response = await service.get(gnmi.proto.GetRequest(path=create_path("system/clock")),) + response = await service.get( + gnmi.proto.GetRequest(path=create_path("system/clock")), + ) validate_response_get(response=response, value={}) diff --git a/tests/integration/test_integration_legacy.py b/tests/integration/test_integration_legacy.py index 0111855..e43c80a 100644 --- a/tests/integration/test_integration_legacy.py +++ b/tests/integration/test_integration_legacy.py @@ -30,7 +30,9 @@ def test_integration_legacy_capabilities(service_legacy): def test_integration__legacy_get(service_legacy, metadata_legacy): response = service_legacy.Get( - gnmi.proto.legacy.GetRequest(path=[create_legacy_path("interfaces")],), + gnmi.proto.legacy.GetRequest( + path=[create_legacy_path("interfaces")], + ), metadata=metadata_legacy, ) @@ -44,7 +46,10 @@ def _update( metadata: List[Tuple[str, str]], ) -> gnmi.proto.legacy.SetResponse: response = service_legacy.Set( - gnmi.proto.legacy.SetRequest(update=[update],), metadata=metadata, + gnmi.proto.legacy.SetRequest( + update=[update], + ), + metadata=metadata, ) assert isinstance(response, gnmi.proto.legacy.SetResponse) return response @@ -61,7 +66,10 @@ def test_integration_legacy_update_set_string(service_legacy, metadata_legacy): _update(update, service_legacy, metadata_legacy) response = service_legacy.Get( - gnmi.proto.legacy.GetRequest(path=[path],), metadata=metadata_legacy, + gnmi.proto.legacy.GetRequest( + path=[path], + ), + metadata=metadata_legacy, ) validate_response_get(response=response, value=new_password) @@ -76,7 +84,10 @@ def test_integration_legacy_update_set_json(service_legacy, metadata_legacy): _update(update, service_legacy, metadata_legacy) response = service_legacy.Get( - gnmi.proto.legacy.GetRequest(path=[path],), metadata=metadata_legacy, + gnmi.proto.legacy.GetRequest( + path=[path], + ), + metadata=metadata_legacy, ) validate_response_get(response=response, value=config) @@ -89,7 +100,9 @@ def test_integration_legacy_delete(service_legacy, metadata_legacy): ) response = service_legacy.Get( - gnmi.proto.legacy.GetRequest(path=[create_legacy_path("system/clock")],), + gnmi.proto.legacy.GetRequest( + path=[create_legacy_path("system/clock")], + ), metadata=metadata_legacy, ) validate_response_get(response=response, value={})