From d2a5a5920fffcc48e6141f4126c491343800d16a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 16 Jan 2020 20:00:39 +0400 Subject: [PATCH] Move IPv6 test skips in server fixtures --- test/conftest.py | 7 +++++++ test/with_dummyserver/test_https.py | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/test/conftest.py b/test/conftest.py index 7448d11f67..ace65a9450 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -16,6 +16,7 @@ CLIENT_INTERMEDIATE_PEM, CLIENT_NO_INTERMEDIATE_PEM, CLIENT_INTERMEDIATE_KEY, + HAS_IPV6, ) @@ -100,6 +101,9 @@ def ip_san_server(tmp_path_factory): @pytest.fixture def ipv6_addr_server(tmp_path_factory): + if not HAS_IPV6: + pytest.skip("Only runs on IPv6 systems") + tmpdir = tmp_path_factory.mktemp("certs") ca = trustme.CA() # IP address in Common Name @@ -111,6 +115,9 @@ def ipv6_addr_server(tmp_path_factory): @pytest.fixture def ipv6_san_server(tmp_path_factory): + if not HAS_IPV6: + pytest.skip("Only runs on IPv6 systems") + tmpdir = tmp_path_factory.mktemp("certs") ca = trustme.CA() # IP address in Subject Alternative Name diff --git a/test/with_dummyserver/test_https.py b/test/with_dummyserver/test_https.py index 4f050bf5d0..1dfbdabd56 100644 --- a/test/with_dummyserver/test_https.py +++ b/test/with_dummyserver/test_https.py @@ -18,7 +18,6 @@ DEFAULT_CA, DEFAULT_CA_BAD, DEFAULT_CERTS, - HAS_IPV6, PASSWORD_CLIENT_KEYFILE, ) @@ -735,7 +734,6 @@ def test_can_validate_ip_san(self, ip_san_server): class TestHTTPS_IPv6Addr: - @pytest.mark.skipif(not HAS_IPV6, reason="Only runs on IPv6 systems") def test_strip_square_brackets_before_validating(self, ipv6_addr_server): """Test that the fix for #760 works.""" with HTTPSConnectionPool( @@ -749,7 +747,6 @@ def test_strip_square_brackets_before_validating(self, ipv6_addr_server): class TestHTTPS_IPV6SAN: - @pytest.mark.skipif(not HAS_IPV6, reason="Only runs on IPv6 systems") def test_can_validate_ipv6_san(self, ipv6_san_server): """Ensure that urllib3 can validate SANs with IPv6 addresses in them.""" try: