Skip to content

FAIL: test_no_new_lines (tests.unit.test_utils.TestIsValidEndpointURL) ; with Python versions patched for bpo-43882 #2377

@mgorny

Description

@mgorny

Describe the bug
The recent fix to bpo43882 has caused the following test to start to fail:

======================================================================
FAIL: test_no_new_lines (tests.unit.test_utils.TestIsValidEndpointURL)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/portage/dev-python/botocore-1.20.64/work/botocore-1.20.64/tests/unit/test_utils.py", line 713, in test_no_new_lines
    self.assertFalse(is_valid_endpoint_url('https://foo.bar.com\nbar/'))
AssertionError: <re.Match object; span=(0, 14), match='foo.bar.combar'> is not false

The relevant behavior change in CPython is that all newlines (as well as CRs and tabs) are stripped from the URL, so they're not present in the split components anymore.

Steps to reproduce
Install Python 3.10.0b1 or 3.9 from git branch (the change is going to be the part of the next release), and run tests with it.

Expected behavior
Tests passing ;-). I suppose you could either check URLs for newlines early on, and reject all newlines, or agree with the new behavior of stripping them. In the latter case, it might make sense to add stripping inside botocore too, for consistent behavior across Python versions.

Debug logs
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a confirmed bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions