From 829462020b9a2dde48db6d03cc5d3e8ce7c1b247 Mon Sep 17 00:00:00 2001 From: Adrian Chaves Date: Sun, 9 Aug 2026 17:55:27 +0200 Subject: [PATCH] Skip test on bad w3lib --- tests/test_downloadermiddleware_httpcache.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/test_downloadermiddleware_httpcache.py b/tests/test_downloadermiddleware_httpcache.py index 0c2635b76..fd6b74f47 100644 --- a/tests/test_downloadermiddleware_httpcache.py +++ b/tests/test_downloadermiddleware_httpcache.py @@ -9,6 +9,7 @@ from contextlib import contextmanager from pathlib import Path from typing import TYPE_CHECKING, Any from unittest import mock +from urllib.parse import urlparse import pytest @@ -781,7 +782,14 @@ class TestFilesystemStorageScope(ScopeTestMixin): ("url", "expected"), [ ("http://user:pass@WWW.Example.com:8080/", "www.example.com"), - ("http://[::1]/", "%3A%3A1"), + pytest.param( + "http://[::1]/", + "%3A%3A1", + marks=pytest.mark.skipif( + urlparse(Request("http://[::1]/").url).hostname != "::1", + reason="w3lib strips the brackets of IPv6 hosts", + ), + ), ("file:///tmp/t.txt", "_"), ], )