-
-
Notifications
You must be signed in to change notification settings - Fork 547
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
Rename misleading test client argument name #3661
Rename misleading test client argument name #3661
Conversation
Reviewer's Guide by SourceryThis pull request renames the Class diagram for test client argument changesclassDiagram
class GraphQLTestClient {
+query(query: str, variables: Optional[Dict[str, Mapping]] = None, headers: Optional[Dict[str, object]] = None, asserts_errors: Optional[bool] = None, assert_no_errors: Optional[bool] = True, files: Optional[Dict[str, object]] = None) Response
}
class AiohttpGraphQLTestClient {
+query(query: str, variables: Optional[Dict[str, Mapping]] = None, headers: Optional[Dict[str, object]] = None, asserts_errors: Optional[bool] = None, assert_no_errors: Optional[bool] = True, files: Optional[Dict[str, object]] = None) Response
}
class AsgiGraphQLTestClient {
+query(query: str, variables: Optional[Dict[str, Mapping]] = None, headers: Optional[Dict[str, object]] = None, asserts_errors: Optional[bool] = None, assert_no_errors: Optional[bool] = True, files: Optional[Dict[str, object]] = None) Response
}
class DjangoGraphQLTestClient {
+query(query: str, variables: Optional[Dict[str, Mapping]] = None, headers: Optional[Dict[str, object]] = None, asserts_errors: Optional[bool] = None, assert_no_errors: Optional[bool] = True, files: Optional[Dict[str, object]] = None) Response
}
GraphQLTestClient <|-- AiohttpGraphQLTestClient
GraphQLTestClient <|-- AsgiGraphQLTestClient
GraphQLTestClient <|-- DjangoGraphQLTestClient
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @DoctorJohn - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider updating the documentation to highlight the deprecation of the
asserts_errors
argument and the introduction ofassert_no_errors
. This will help users understand the change and encourage them to update their code.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 2 issues found
- 🟢 Complexity: all looks good
- 🟡 Documentation: 1 issue found
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Thanks for adding the Here's a preview of the changelog: The AIOHTTP, ASGI, and Django test clients' Here's the tweet text:
|
8c3b051
to
f5c5c87
Compare
CodSpeed Performance ReportMerging #3661 will not alter performanceComparing Summary
|
3697f8f
to
0e6d88d
Compare
0e6d88d
to
846a474
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3661 +/- ##
==========================================
+ Coverage 96.82% 96.93% +0.11%
==========================================
Files 503 504 +1
Lines 33409 33448 +39
Branches 5583 5600 +17
==========================================
+ Hits 32348 32423 +75
+ Misses 830 793 -37
- Partials 231 232 +1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
Maybe we should consolidate the test clients in future (we have private ones in the tests folder :D)
Yeah, I think that's a great idea. I didn't even know we had a public test client because it doesn't appear to be documented and did not really have tests. Our internal test client is much more capable and could be a good basis for a unified test client. |
Description
This PR renames the
asserts_errors
of our user-facing test clients toassert_no_errors
as proposed in #3580. The old option is still available but will raise a deprecation warning.Also, before this PR, only the Django test client had tests. Now, all test clients share the tests. (That's why this PR is a little bigger than one might expect).
Types of Changes
Issues Fixed or Closed by This PR
asserts_errors
flag behaviour is counter intuitive #3580Summary by Sourcery
Rename the
asserts_errors
argument toassert_no_errors
in test clients for clarity, add shared tests for all clients, and document the change with a release note.Enhancements:
asserts_errors
argument toassert_no_errors
in test clients to better reflect its purpose, while maintaining backward compatibility with a deprecation warning for the old argument.Documentation:
asserts_errors
option toassert_no_errors
in test clients, highlighting the backward compatibility and deprecation warning.Tests:
asserts_errors
argument and the functionality of theassert_no_errors
option.