Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor TestClient usage #3121

Merged
merged 2 commits into from
Dec 27, 2024
Merged

Refactor TestClient usage #3121

merged 2 commits into from
Dec 27, 2024

Conversation

Turbo87
Copy link
Collaborator

@Turbo87 Turbo87 commented Dec 27, 2024

This PR changes how the TestClient struct from axum is shared with axum-extra and also makes it available to axum-core.

This change avoids the somewhat arcane include!(concat!(...)) construct in the axum-extra crate, which some IDEs (JetBrains) don't like particularly much. The alternative proposed by this PR is a __private feature, similar to the one in axum-macros, that enables the public export of the TestClient struct. The axum dev-dependencies in the other two crates then enable that feature, so that it can be used in their test suites.

This enables us to move the request_parts tests into axum-core, next to the implementation that they are testing.

This avoids the somewhat arcane `include!(concat!(...))` construct in the `axum-extra` crate, which some IDEs (JetBrains) don't like particularly much...
This is where the extractor is implemented, so it would make sense to colocate the tests there too.
@jplatte
Copy link
Member

jplatte commented Dec 27, 2024

I like the idea! Will review later.

@Turbo87 Turbo87 merged commit 28d8d9b into tokio-rs:main Dec 27, 2024
18 checks passed
@Turbo87 Turbo87 deleted the test-client branch December 27, 2024 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants