From 00da5ac5af7c99d40c898e8d45a0d973535f1bdf Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Tue, 16 May 2023 14:05:05 +0200 Subject: [PATCH] Make test_headers robust with regard to order of headers --- tests/integration/test_urllib3.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/integration/test_urllib3.py b/tests/integration/test_urllib3.py index 635e00f..95d9042 100644 --- a/tests/integration/test_urllib3.py +++ b/tests/integration/test_urllib3.py @@ -8,6 +8,7 @@ from assertions import assert_cassette_empty, assert_is_json import vcr from vcr.patch import force_reset +from vcr.stubs.compat import get_headers urllib3 = pytest.importorskip("urllib3") @@ -41,7 +42,8 @@ def test_headers(tmpdir, httpbin_both, verify_pool_mgr): headers = verify_pool_mgr.request("GET", url).headers with vcr.use_cassette(str(tmpdir.join("headers.yaml"))): - assert headers == verify_pool_mgr.request("GET", url).headers + new_headers = verify_pool_mgr.request("GET", url).headers + assert sorted(get_headers(headers)) == sorted(get_headers(new_headers)) def test_body(tmpdir, httpbin_both, verify_pool_mgr):