From df94d4709139f0ce7d3c1d3ede32f4f636b53893 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Varl=C4=B1?= Date: Thu, 12 Jan 2023 10:43:16 +0000 Subject: [PATCH] Fix linting issues --- .../smithy/testutil/PythonServerTestHelpers.kt | 13 ++++++++----- .../smithy/generators/PythonServerTypesTest.kt | 13 +++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/testutil/PythonServerTestHelpers.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/testutil/PythonServerTestHelpers.kt index 7068cea2ccf..e38e1ae67c3 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/testutil/PythonServerTestHelpers.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/testutil/PythonServerTestHelpers.kt @@ -36,8 +36,11 @@ fun executePythonServerCodegenVisitor(pluginCtx: PluginContext) { fun cargoTest(workdir: Path) = // `--no-default-features` is required to disable `pyo3/extension-module` which causes linking errors // see `PyO3ExtensionModuleDecorator`'s comments fore more detail. - "cargo test --no-default-features".runCommand(workdir, mapOf( - // Those are required to run tests on macOS, see: https://pyo3.rs/main/building_and_distribution#macos - "CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS" to "-C link-arg=-undefined -C link-arg=dynamic_lookup", - "CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS" to "-C link-arg=-undefined -C link-arg=dynamic_lookup" - )) + "cargo test --no-default-features".runCommand( + workdir, + mapOf( + // Those are required to run tests on macOS, see: https://pyo3.rs/main/building_and_distribution#macos + "CARGO_TARGET_X86_64_APPLE_DARWIN_RUSTFLAGS" to "-C link-arg=-undefined -C link-arg=dynamic_lookup", + "CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS" to "-C link-arg=-undefined -C link-arg=dynamic_lookup", + ), + ) diff --git a/codegen-server/python/src/test/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerTypesTest.kt b/codegen-server/python/src/test/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerTypesTest.kt index b5d45c273df..c15b399744b 100644 --- a/codegen-server/python/src/test/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerTypesTest.kt +++ b/codegen-server/python/src/test/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/generators/PythonServerTypesTest.kt @@ -55,14 +55,14 @@ internal class PythonServerTypesTest { """ assert input.value == 42 output = EchoOutput(value=input.value) - """ + """, ), Pair( """ { "value": "foobar" } """, """ assert input.value == "foobar" output = EchoOutput(value=input.value) - """ + """, ), Pair( """ @@ -83,9 +83,9 @@ internal class PythonServerTypesTest { } """, """ - assert input.value == [True, False, 42, 42.0, -42, dict(nested="value"), dict(nested=[1, 2, 3])] + assert input.value == [True, False, 42, 42.0, -42, {"nested": "value"}, {"nested": [1, 2, 3]}] output = EchoOutput(value=input.value) - """ + """, ), ) @@ -99,7 +99,7 @@ internal class PythonServerTypesTest { use crate::{input, output}; pyo3::prepare_freethreaded_python(); - """.trimIndent() + """.trimIndent(), ) testCases.forEach { @@ -132,9 +132,10 @@ internal class PythonServerTypesTest { .unwrap(); let res = service.call(req).await.unwrap(); + assert!(res.status().is_success()); let body = body::to_bytes(res.into_body()).await.unwrap(); assert_eq!(body, ${payload.dq()}); - """.trimIndent() + """.trimIndent(), ) } }