Skip to content

Commit

Permalink
Fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
unexge committed Jan 23, 2023
1 parent 76379d9 commit fd6d928
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
),
)
Original file line number Diff line number Diff line change
Expand Up @@ -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(
"""
Expand All @@ -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)
"""
""",
),
)

Expand All @@ -99,7 +99,7 @@ internal class PythonServerTypesTest {
use crate::{input, output};
pyo3::prepare_freethreaded_python();
""".trimIndent()
""".trimIndent(),
)

testCases.forEach {
Expand Down Expand Up @@ -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(),
)
}
}
Expand Down

0 comments on commit fd6d928

Please sign in to comment.