mirror of
https://github.com/httpie/cli.git
synced 2025-03-13 06:18:33 +01:00
fix test when http3 support is unavailable (windows+py3.7)
This commit is contained in:
parent
46ca048a3a
commit
f6f6619140
@ -5,6 +5,11 @@ from httpie.ssl_ import QuicCapabilityCache
|
||||
|
||||
from .utils import HTTP_OK, http, PersistentMockEnvironment
|
||||
|
||||
try:
|
||||
import qh3
|
||||
except ImportError:
|
||||
qh3 = None
|
||||
|
||||
|
||||
def test_should_not_do_http1_by_default(remote_httpbin_secure):
|
||||
r = http(
|
||||
@ -29,6 +34,7 @@ def test_disable_http2n3(remote_httpbin_secure):
|
||||
assert HTTP_OK in r
|
||||
|
||||
|
||||
@pytest.mark.skipif(qh3 is None, reason="test require HTTP/3 support")
|
||||
def test_force_http3(remote_httpbin_secure):
|
||||
r = http(
|
||||
"--verify=no",
|
||||
@ -48,6 +54,7 @@ def with_quic_cache_persistent(tmp_path):
|
||||
env.cleanup(force=True)
|
||||
|
||||
|
||||
@pytest.mark.skipif(qh3 is None, reason="test require HTTP/3 support")
|
||||
def test_ensure_quic_cache(remote_httpbin_secure, with_quic_cache_persistent):
|
||||
"""
|
||||
This test aim to verify that the QuicCapabilityCache work as intended.
|
||||
@ -79,6 +86,7 @@ def test_ensure_quic_cache(remote_httpbin_secure, with_quic_cache_persistent):
|
||||
assert "pie.dev" in list(cache.keys())[0]
|
||||
|
||||
|
||||
@pytest.mark.skipif(qh3 is None, reason="test require HTTP/3 support")
|
||||
def test_h3_not_compatible_anymore(remote_httpbin_secure, with_quic_cache_persistent):
|
||||
"""verify that we can handle failures and fallback appropriately."""
|
||||
tmp_path = with_quic_cache_persistent.config['quic_file']
|
||||
|
@ -4,12 +4,18 @@ from httpie.models import ELAPSED_TIME_LABEL
|
||||
from httpie.output.formatters.colors import PIE_STYLE_NAMES
|
||||
from .utils import http, MockEnvironment, COLOR
|
||||
|
||||
try:
|
||||
import qh3
|
||||
except ImportError:
|
||||
qh3 = None
|
||||
|
||||
|
||||
def test_meta_elapsed_time(httpbin):
|
||||
r = http('--meta', httpbin + '/delay/1')
|
||||
assert f'{ELAPSED_TIME_LABEL}: 1.' in r
|
||||
|
||||
|
||||
@pytest.mark.skipif(qh3 is None, reason="test require HTTP/3 support")
|
||||
def test_meta_extended_tls(remote_httpbin_secure):
|
||||
# using --verify=no may cause the certificate information not to display with Python < 3.10
|
||||
# it is guaranteed to be there when using HTTP/3 over QUIC. That's why we set the '--http3' flag.
|
||||
|
@ -1,6 +1,14 @@
|
||||
import pytest
|
||||
|
||||
from .utils import http
|
||||
|
||||
try:
|
||||
import qh3
|
||||
except ImportError:
|
||||
qh3 = None
|
||||
|
||||
|
||||
@pytest.mark.skipif(qh3 is None, reason="test require HTTP/3 support")
|
||||
def test_ensure_resolver_used(remote_httpbin_secure):
|
||||
"""This test ensure we're using specified resolver to get into pie.dev.
|
||||
Using a custom resolver with Niquests enable direct HTTP/3 negotiation and pie.dev
|
||||
|
Loading…
Reference in New Issue
Block a user