File size: 16,917 Bytes
11c83cb
1
{"language": "Python", "id": 74, "repo_owner": "encode", "repo_name": "httpx", "head_branch": "cookie-persistence-option", "workflow_name": "Test Suite", "workflow_filename": "test-suite.yml", "workflow_path": ".github/workflows/test-suite.yml", "contributor": "MarkWine", "sha_fail": "aa8a42bcf03f3b89575a9cce2f8af715a5121c59", "sha_success": "841f11c1a93299b9032d18d0bb5d112421149336", "workflow": "---\nname: Test Suite\n\non:\n  push:\n    branches: [\"master\"]\n  pull_request:\n    branches: [\"master\"]\n\njobs:\n  tests:\n    name: \"Python ${{ matrix.python-version }}\"\n    runs-on: \"ubuntu-latest\"\n\n    strategy:\n      matrix:\n        python-version: [\"3.8\", \"3.9\", \"3.10\", \"3.11\", \"3.12\"]\n\n    steps:\n      - uses: \"actions/checkout@v4\"\n      - uses: \"actions/setup-python@v4\"\n        with:\n          python-version: \"${{ matrix.python-version }}\"\n          allow-prereleases: true\n      - name: \"Install dependencies\"\n        run: \"scripts/install\"\n      - name: \"Run linting checks\"\n        run: \"scripts/check\"\n      - name: \"Build package & docs\"\n        run: \"scripts/build\"\n      - name: \"Run tests\"\n        run: \"scripts/test\"\n      - name: \"Enforce coverage\"\n        run: \"scripts/coverage\"\n", "logs": [{"step_name": "Python 3.8/7_Run tests.txt", "log": "##[group]Run scripts/test\n\u001b[36;1mscripts/test\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n  pythonLocation: /opt/hostedtoolcache/Python/3.8.18/x64\n  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib/pkgconfig\n  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.18/x64\n  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.18/x64/lib\n##[endgroup]\n+ [ -z true ]\n+ coverage run -m pytest\n============================= test session starts ==============================\nplatform linux -- Python 3.8.18, pytest-7.4.4, pluggy-1.3.0\nrootdir: /home/runner/work/httpx/httpx\nconfigfile: pyproject.toml\nplugins: anyio-4.2.0\ncollected 855 items\n\ntests/test_api.py ...........                                            [  1%]\ntests/test_asgi.py ........................                              [  4%]\ntests/test_auth.py ........                                              [  5%]\ntests/test_config.py ...............................                     [  8%]\ntests/test_content.py ........................................           [ 13%]\ntests/test_decoders.py ...................................               [ 17%]\ntests/test_exceptions.py ...                                             [ 17%]\ntests/test_exported_members.py .                                         [ 17%]\ntests/test_main.py ...........                                           [ 19%]\ntests/test_multipart.py ......................................           [ 23%]\ntests/test_status_codes.py ......                                        [ 24%]\ntests/test_timeouts.py ........                                          [ 25%]\ntests/test_utils.py .................................................... [ 31%]\n....                                                                     [ 31%]\ntests/test_wsgi.py ............                                          [ 33%]\ntests/client/test_async_client.py ...................................... [ 37%]\n..............                                                           [ 39%]\ntests/client/test_auth.py .............................................. [ 44%]\n..........................s........                                      [ 48%]\ntests/client/test_client.py ...................................          [ 52%]\ntests/client/test_cookies.py .....FF.                                    [ 53%]\ntests/client/test_event_hooks.py .........                               [ 54%]\ntests/client/test_headers.py ...........                                 [ 56%]\ntests/client/test_properties.py ........                                 [ 57%]\ntests/client/test_proxies.py ........................................... [ 62%]\n....................................                                     [ 66%]\ntests/client/test_queryparams.py ...                                     [ 66%]\ntests/client/test_redirects.py .............................F.           [ 70%]\ntests/models/test_cookies.py .......                                     [ 71%]\ntests/models/test_headers.py ..................                          [ 73%]\ntests/models/test_queryparams.py ..............                          [ 74%]\ntests/models/test_requests.py .......................                    [ 77%]\ntests/models/test_responses.py ......................................... [ 82%]\n.................................................................        [ 89%]\ntests/models/test_url.py ............................................... [ 95%]\n.......................................                                  [100%]\n\n=================================== FAILURES ===================================\n_______________________________ test_get_cookie ________________________________\n\n    def test_get_cookie() -> None:\n        url = \"http://example.org/set_cookie\"\n    \n        client = httpx.Client(transport=httpx.MockTransport(get_and_set_cookies))\n        response = client.get(url)\n    \n        assert response.status_code == 200\n        assert response.cookies[\"example-name\"] == \"example-value\"\n>       assert client.cookies[\"example-name\"] == \"example-value\"\n\ntests/client/test_cookies.py:148: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Cookies[]>, name = 'example-name'\n\n    def __getitem__(self, name: str) -> str:\n        value = self.get(name)\n        if value is None:\n>           raise KeyError(name)\nE           KeyError: 'example-name'\n\nhttpx/_models.py:1154: KeyError\n___________________________ test_cookie_persistence ____________________________\n\n    def test_cookie_persistence() -> None:\n        \"\"\"\n        Ensure that Client instances persist cookies between requests.\n        \"\"\"\n        client = httpx.Client(transport=httpx.MockTransport(get_and_set_cookies))\n    \n        response = client.get(\"http://example.org/echo_cookies\")\n        assert response.status_code == 200\n        assert response.json() == {\"cookies\": None}\n    \n        response = client.get(\"http://example.org/set_cookie\")\n        assert response.status_code == 200\n        assert response.cookies[\"example-name\"] == \"example-value\"\n>       assert client.cookies[\"example-name\"] == \"example-value\"\n\ntests/client/test_cookies.py:164: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Cookies[]>, name = 'example-name'\n\n    def __getitem__(self, name: str) -> str:\n        value = self.get(name)\n        if value is None:\n>           raise KeyError(name)\nE           KeyError: 'example-name'\n\nhttpx/_models.py:1154: KeyError\n________________________ test_redirect_cookie_behavior _________________________\n\n    def test_redirect_cookie_behavior():\n        client = httpx.Client(\n            transport=httpx.MockTransport(cookie_sessions), follow_redirects=True\n        )\n    \n        # The client is not logged in.\n        response = client.get(\"https://example.com/\")\n        assert response.url == \"https://example.com/\"\n        assert response.text == \"Not logged in\"\n    \n        # Login redirects to the homepage, setting a session cookie.\n        response = client.post(\"https://example.com/login\")\n        assert response.url == \"https://example.com/\"\n>       assert response.text == \"Logged in\"\nE       AssertionError: assert 'Not logged in' == 'Logged in'\nE         - Logged in\nE         + Not logged in\n\ntests/client/test_redirects.py:416: AssertionError\n=========================== short test summary info ============================\nSKIPPED [1] tests/client/test_auth.py:272: netrc files without a password are invalid with Python < 3.11\n================== 3 failed, 851 passed, 1 skipped in 17.34s ===================\n##[error]Process completed with exit code 1.\n"}, {"step_name": "Python 3.11/7_Run tests.txt", "log": "##[group]Run scripts/test\n\u001b[36;1mscripts/test\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n  pythonLocation: /opt/hostedtoolcache/Python/3.11.7/x64\n  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.11.7/x64/lib/pkgconfig\n  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.7/x64\n  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.7/x64\n  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.11.7/x64\n  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.7/x64/lib\n##[endgroup]\n+ [ -z true ]\n+ coverage run -m pytest\n============================= test session starts ==============================\nplatform linux -- Python 3.11.7, pytest-7.4.4, pluggy-1.3.0\nrootdir: /home/runner/work/httpx/httpx\nconfigfile: pyproject.toml\nplugins: anyio-4.2.0\ncollected 855 items\n\ntests/test_api.py ...........                                            [  1%]\ntests/test_asgi.py ........................                              [  4%]\ntests/test_auth.py ........                                              [  5%]\ntests/test_config.py ...............................                     [  8%]\ntests/test_content.py ........................................           [ 13%]\ntests/test_decoders.py ...................................               [ 17%]\ntests/test_exceptions.py ...                                             [ 17%]\ntests/test_exported_members.py .                                         [ 17%]\ntests/test_main.py ...........                                           [ 19%]\ntests/test_multipart.py ......................................           [ 23%]\ntests/test_status_codes.py ......                                        [ 24%]\ntests/test_timeouts.py ........                                          [ 25%]\ntests/test_utils.py .................................................... [ 31%]\n....                                                                     [ 31%]\ntests/test_wsgi.py ............                                          [ 33%]\ntests/client/test_async_client.py ...................................... [ 37%]\n..............                                                           [ 39%]\ntests/client/test_auth.py .............................................. [ 44%]\n...........................s.......                                      [ 48%]\ntests/client/test_client.py ...................................          [ 52%]\ntests/client/test_cookies.py .....FF.                                    [ 53%]\ntests/client/test_event_hooks.py .........                               [ 54%]\ntests/client/test_headers.py ...........                                 [ 56%]\ntests/client/test_properties.py ........                                 [ 57%]\ntests/client/test_proxies.py ........................................... [ 62%]\n....................................                                     [ 66%]\ntests/client/test_queryparams.py ...                                     [ 66%]\ntests/client/test_redirects.py .............................F.           [ 70%]\ntests/models/test_cookies.py .......                                     [ 71%]\ntests/models/test_headers.py ..................                          [ 73%]\ntests/models/test_queryparams.py ..............                          [ 74%]\ntests/models/test_requests.py .......................                    [ 77%]\ntests/models/test_responses.py ......................................... [ 82%]\n.................................................................        [ 89%]\ntests/models/test_url.py ............................................... [ 95%]\n.......................................                                  [100%]\n\n=================================== FAILURES ===================================\n_______________________________ test_get_cookie ________________________________\n\n    def test_get_cookie() -> None:\n        url = \"http://example.org/set_cookie\"\n    \n        client = httpx.Client(transport=httpx.MockTransport(get_and_set_cookies))\n        response = client.get(url)\n    \n        assert response.status_code == 200\n        assert response.cookies[\"example-name\"] == \"example-value\"\n>       assert client.cookies[\"example-name\"] == \"example-value\"\n\ntests/client/test_cookies.py:148: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Cookies[]>, name = 'example-name'\n\n    def __getitem__(self, name: str) -> str:\n        value = self.get(name)\n        if value is None:\n>           raise KeyError(name)\nE           KeyError: 'example-name'\n\nhttpx/_models.py:1154: KeyError\n___________________________ test_cookie_persistence ____________________________\n\n    def test_cookie_persistence() -> None:\n        \"\"\"\n        Ensure that Client instances persist cookies between requests.\n        \"\"\"\n        client = httpx.Client(transport=httpx.MockTransport(get_and_set_cookies))\n    \n        response = client.get(\"http://example.org/echo_cookies\")\n        assert response.status_code == 200\n        assert response.json() == {\"cookies\": None}\n    \n        response = client.get(\"http://example.org/set_cookie\")\n        assert response.status_code == 200\n        assert response.cookies[\"example-name\"] == \"example-value\"\n>       assert client.cookies[\"example-name\"] == \"example-value\"\n\ntests/client/test_cookies.py:164: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nself = <Cookies[]>, name = 'example-name'\n\n    def __getitem__(self, name: str) -> str:\n        value = self.get(name)\n        if value is None:\n>           raise KeyError(name)\nE           KeyError: 'example-name'\n\nhttpx/_models.py:1154: KeyError\n________________________ test_redirect_cookie_behavior _________________________\n\n    def test_redirect_cookie_behavior():\n        client = httpx.Client(\n            transport=httpx.MockTransport(cookie_sessions), follow_redirects=True\n        )\n    \n        # The client is not logged in.\n        response = client.get(\"https://example.com/\")\n        assert response.url == \"https://example.com/\"\n        assert response.text == \"Not logged in\"\n    \n        # Login redirects to the homepage, setting a session cookie.\n        response = client.post(\"https://example.com/login\")\n        assert response.url == \"https://example.com/\"\n>       assert response.text == \"Logged in\"\nE       AssertionError: assert 'Not logged in' == 'Logged in'\nE         - Logged in\nE         + Not logged in\n\ntests/client/test_redirects.py:416: AssertionError\n=========================== short test summary info ============================\nSKIPPED [1] tests/client/test_auth.py:295: netrc files without a password are valid from Python >= 3.11\n================== 3 failed, 851 passed, 1 skipped in 16.79s ===================\n##[error]Process completed with exit code 1.\n"}], "diff": "diff --git a/httpx/_client.py b/httpx/_client.py\nindex 0a7490d..113eb47 100644\n--- a/httpx/_client.py\n+++ b/httpx/_client.py\n@@ -164,7 +164,7 @@ class BaseClient:\n         params: typing.Optional[QueryParamTypes] = None,\n         headers: typing.Optional[HeaderTypes] = None,\n         cookies: typing.Optional[CookieTypes] = None,\n-        persistent_cookies: bool = False,\n+        persistent_cookies: bool = True,\n         timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,\n         follow_redirects: bool = False,\n         max_redirects: int = DEFAULT_MAX_REDIRECTS,\n@@ -630,7 +630,7 @@ class Client(BaseClient):\n         params: typing.Optional[QueryParamTypes] = None,\n         headers: typing.Optional[HeaderTypes] = None,\n         cookies: typing.Optional[CookieTypes] = None,\n-        persistent_cookies: bool = False,\n+        persistent_cookies: bool = True,\n         verify: VerifyTypes = True,\n         cert: typing.Optional[CertTypes] = None,\n         http1: bool = True,\n@@ -1375,7 +1375,7 @@ class AsyncClient(BaseClient):\n         params: typing.Optional[QueryParamTypes] = None,\n         headers: typing.Optional[HeaderTypes] = None,\n         cookies: typing.Optional[CookieTypes] = None,\n-        persistent_cookies: bool = False,\n+        persistent_cookies: bool = True,\n         verify: VerifyTypes = True,\n         cert: typing.Optional[CertTypes] = None,\n         http1: bool = True,\n", "difficulty": 3, "changed_files": ["httpx/_client.py"], "commit_link": "https://github.com/encode/httpx/tree/aa8a42bcf03f3b89575a9cce2f8af715a5121c59"}