Skip to content

fix tests due to incompatibility with requests 2.34 - #25

Merged
cle-b merged 2 commits into
mainfrom
fixtestrequests
Aug 10, 2026
Merged

cle-b merged 2 commits into
mainfrom
fixtestrequests

Conversation

@cle-b

@cle-b cle-b commented Aug 10, 2026 •

Copy link
Copy Markdown
Owner

This PR fixes the tests to make them compatible with requests 2.34.2.

With requests 2.34, many tests fail with the following error:

conftest.py:7: in fixture_session
    requests.get(httpbin.url + "/setupsession")
/home/cle/dev/pytest-httpdbg/venv/lib/python3.12/site-packages/httpdbg/hooks/requests.py:19: in hook
    ret = method(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^
/home/cle/dev/pytest-httpdbg/venv/lib/python3.12/site-packages/requests/api.py:87: in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/cle/dev/pytest-httpdbg/venv/lib/python3.12/site-packages/requests/api.py:71: in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/cle/dev/pytest-httpdbg/venv/lib/python3.12/site-packages/httpdbg/hooks/requests.py:19: in hook
    ret = method(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^
/home/cle/dev/pytest-httpdbg/venv/lib/python3.12/site-packages/requests/sessions.py:635: in request
    prep = self.prepare_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
/home/cle/dev/pytest-httpdbg/venv/lib/python3.12/site-packages/requests/sessions.py:532: in prepare_request
    merge_cookies(RequestsCookieJar(), self.cookies), cookies
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cookiejar = <RequestsCookieJar[]>, cookies = <RequestsCookieJar[]>

    def merge_cookies(
        cookiejar: CookieJar, cookies: dict[str, str] | CookieJar | None
    ) -> CookieJar:
        """Add cookies to cookiejar and returns a merged CookieJar.
    
        :param cookiejar: CookieJar object to add the cookies to.
        :param cookies: Dictionary or CookieJar object to be added.
        :rtype: CookieJar
        """
        if not isinstance(cookiejar, cookielib.CookieJar):  # type: ignore[reportUnnecessaryIsInstance]  # runtime guard
>           raise ValueError("You can only merge into CookieJar")
E           ValueError: You can only merge into CookieJar

/home/cle/dev/pytest-httpdbg/venv/lib/python3.12/site-packages/requests/cookies.py:614: ValueError

What's changed

To avoid the error, the pytest run inside pytest are now executed in a subprocess.

Verification

The tests now pass.

@cle-b
cle-b deployed to release August 10, 2026 20:26 — with GitHub Actions Active
@cle-b
cle-b merged commit c91ccf2 into main Aug 10, 2026
20 checks passed
@cle-b
cle-b deleted the fixtestrequests branch August 10, 2026 20:28

This branch was successfully deployed

1 active deployment
release — 64aae992 Deployed Aug 10, 2026 by cle-b via Deploy on PyPI #95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant