Conversation
extra side_effect extra side_effect
extra type ignore
| class CallList(list, mock.NonCallableMock): | ||
| def __init__(self, *args, name="respx", **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| def __init__(self, *args: Sequence[Call], name: Any = "respx") -> None: |
There was a problem hiding this comment.
Perhaps name: str | None to mimic NonCallableMock?
| def __init__(self, *args: Sequence[Call], name: Any = "respx") -> None: | |
| def __init__(self, *args: Sequence[Call], name: str | None = "respx") -> None: |
There was a problem hiding this comment.
Totally agree, but it's not possible due to this "unfortunate" solution ... https://github.com/lundberg/respx/blob/master/respx/models.py#L115
I use the route instance as mock name to allow it to be dynamic/lazy.
To give some context, the name is only visible on assertion errors, e.g. when accessing NonCallableMock .assert_called_once etc, and passing the route as name is to render an up-to-date repr/str when that happens.
Not a pretty solution, neither an important one 😉.
9aa3f76 to
482b6d7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #217 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 20 20
Lines 2740 2796 +56
Branches 337 350 +13
=========================================
+ Hits 2740 2796 +56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
482b6d7 to
06ff405
Compare
3.11to nox test ssessionmypyon both tests and respxCall.has_responsehelperCall.responseto raise instead of being optionalCallList.lastto raise instead of being optionalM(), andRoute.pattern, to not be optional by introducing aNooppattern