Skip to content

Commit

Permalink
Deal with urlunparse() Python 3.12.6 etc. change in parser selection …
Browse files Browse the repository at this point in the history
…test.
  • Loading branch information
lemon24 committed Sep 17, 2024
1 parent 990418b commit 5ac548c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,21 @@ def test_parser_selection():

assert parse('file:o') == ('urlp-file', ['file:o'], 'type/file', None)
assert file_retriever.last_http_accept is None
assert parse('file:///o') == ('urlp-file', ['file:///o'], 'type/file', None)

# this assert is commented because the selected retriever
# depends on urlunparse() behavior, which in turn depends
# on the python version (also varies for other major versions):
#
# * before 3.12.6: urlunparse(urlparse('file:o')) -> 'file:///o'
# * starting with 3.12.6: urlunparse(urlparse('file:o')) -> 'file:o'
#
# changed in https://github.com/python/cpython/issues/85110
#
# https://github.com/pypa/pip/pull/12964
# says file:whatever is not a valid file: url,
# TODO: maybe we should check (and fail) for invalid file: urls

# assert parse('file:///o') == ('urlp-file', ['file:///o'], 'type/file', None)


def test_retriever_selection():
Expand Down

0 comments on commit 5ac548c

Please sign in to comment.