lundberg / respx

Mock HTTPX with awesome request patterns and response side effects 🦋
https://lundberg.github.io/respx
BSD 3-Clause "New" or "Revised" License
581 stars 38 forks source link

Drop `assert_all_called` from `Router` #233

Closed lundberg closed 12 months ago

lundberg commented 1 year ago

The base Router makes no use of the assert_all_called kwarg.

It should therefor be dropped from Router, but kept and only usable in the main MockRouter.

Also extend Router documentation with an example on how to assert that all routes was called.

morenoh149 commented 1 year ago

I'd like to address this issue. Is it just removing this kwarg? https://github.com/lundberg/respx/blob/master/respx/router.py#L43

Also should this project have a CONTRIBUTING.md?

lundberg commented 1 year ago

I'd like to address this issue. Is it just removing this kwarg? https://github.com/lundberg/respx/blob/master/respx/router.py#L43

Yes, since it doesn't affect anything and is a noop when a plain Router is used.

But to make it clear, the kwarg is kept here for the MockRouter used by respx.mock(...). So, the super call need to be adjusted there as well, so that the setting is not lost for the mock router and its decorator/contextmanager features.

Also should this project have a CONTRIBUTING.md?

Yeah, that's probably a good idea, e.g. I should describe how to run tests, linting etc 😉

lundberg commented 12 months ago

Revisiting this now and actually changed my mind @BeyondEvil 😂

I think we should keep the assert_all_called kwarg/setting since my suggestion by manually calling it in #228 is a working solution.

I'll probably just update the docs and trying to mention this when using the Router manually without any context managers used.