You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
prefix="https://example.com"# no trailing slashmore_specific_prefix=prefix+"/some/path"# no trailing slash
...
s.mount(prefix, prefix_adapter)
s.mount(more_specific_prefix, more_specific_prefix_adapter)
I know that the tests work great and do their job, but adding trailing slashes (e.g., https://example.com/ and https://example.com/some/path/) would align them with the docs and make the prefixes more precise.
Would it be worth opening a PR to update these to include trailing slashes? The tests would stay the same, just following the docs best practice.
The text was updated successfully, but these errors were encountered:
allrob23
changed the title
Adding Trailing Slashes to Mount Test Prefixes to Match Docs Recommendation
tests: add trailing slashes to mount to Match Docs Recommendation
Apr 22, 2025
allrob23
changed the title
tests: add trailing slashes to mount to Match Docs Recommendation
tests: add trailing slashes to mount to match docs recommendation?
Apr 22, 2025
The tests do not need to follow the recommendations for users as they're testing exactly what they're meant to. If you want to add a test case so the documented recommendation doesn't ever break that's fine but the logic is so fundamentally simple that I can't imagine why it would break this but not the existing tests without extreme malice
Thanks for the feedback @sigmavirus24. I totally get that the existing tests are doing their job.
So I opened a PR adding two simple tests: one for prefixes with a trailing / (following the docs) and one for prefixes without it (showing the warned behavior). Could you please take a look when you get a chance? Appreciate it!
I was digging into the docs and noticed this:
link
While checking out some tests that uses the
Session.mount()
, I saw that a few don’t follow this recommendation. For example, in test_session_get_adapter_prefix_matching (https://github.com/psf/requests/blob/main/tests/test_requests.py#L1620):I know that the tests work great and do their job, but adding trailing slashes (e.g., https://example.com/ and https://example.com/some/path/) would align them with the docs and make the prefixes more precise.
Here are the tests I noticed:
Would it be worth opening a PR to update these to include trailing slashes? The tests would stay the same, just following the docs best practice.
The text was updated successfully, but these errors were encountered: