File size: 7,523 Bytes
8f0a8fd
1
{"language": "Python", "id": 28, "repo_owner": "encode", "repo_name": "httpx", "head_branch": "add-ssl-context-argument", "workflow_name": "Test Suite", "workflow_filename": "test-suite.yml", "workflow_path": ".github/workflows/test-suite.yml", "contributor": "karpetrosyan", "sha_fail": "7f351340260c165e18ccd7c83dc783bb371b3797", "sha_success": "8d5983adaf778096bb95171dcafe858f6c6d51bb", "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@v5\"\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/8_Enforce coverage.txt", "log": "##[group]Run scripts/coverage\n\u001b[36;1mscripts/coverage\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+ coverage report --show-missing --skip-covered --fail-under=100\nName               Stmts   Miss  Cover   Missing\n------------------------------------------------\nhttpx/_config.py     133      1    99%   139\n------------------------------------------------\nTOTAL               7570      1    99%\n\n58 files skipped due to complete coverage.\nCoverage failure: total of 99 is less than fail-under=100\n##[error]Process completed with exit code 2.\n"}, {"step_name": "Python 3.9/8_Enforce coverage.txt", "log": "##[group]Run scripts/coverage\n\u001b[36;1mscripts/coverage\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n  pythonLocation: /opt/hostedtoolcache/Python/3.9.18/x64\n  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib/pkgconfig\n  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.9.18/x64\n  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.9.18/x64/lib\n##[endgroup]\n+ coverage report --show-missing --skip-covered --fail-under=100\nName               Stmts   Miss  Cover   Missing\n------------------------------------------------\nhttpx/_config.py     133      1    99%   139\n------------------------------------------------\nTOTAL               7570      1    99%\n\n58 files skipped due to complete coverage.\nCoverage failure: total of 99 is less than fail-under=100\n##[error]Process completed with exit code 2.\n"}, {"step_name": "Python 3.10/8_Enforce coverage.txt", "log": "##[group]Run scripts/coverage\n\u001b[36;1mscripts/coverage\u001b[0m\nshell: /usr/bin/bash -e {0}\nenv:\n  pythonLocation: /opt/hostedtoolcache/Python/3.10.13/x64\n  PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib/pkgconfig\n  Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64\n  Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64\n  Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.10.13/x64\n  LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.13/x64/lib\n##[endgroup]\n+ coverage report --show-missing --skip-covered --fail-under=100\nName               Stmts   Miss  Cover   Missing\n------------------------------------------------\nhttpx/_config.py     133      1    99%   139\n------------------------------------------------\nTOTAL               7577      1    99%\n\n58 files skipped due to complete coverage.\nCoverage failure: total of 99 is less than fail-under=100\n##[error]Process completed with exit code 2.\n"}, {"step_name": "Python 3.11/8_Enforce coverage.txt", "log": "##[group]Run scripts/coverage\n\u001b[36;1mscripts/coverage\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+ coverage report --show-missing --skip-covered --fail-under=100\nName               Stmts   Miss  Cover   Missing\n------------------------------------------------\nhttpx/_config.py     133      1    99%   139\n------------------------------------------------\nTOTAL               7577      1    99%\n\n58 files skipped due to complete coverage.\nCoverage failure: total of 99 is less than fail-under=100\n##[error]Process completed with exit code 2.\n"}], "diff": "diff --git a/docs/advanced/ssl.md b/docs/advanced/ssl.md\nindex 1eec32f..2c3e679 100644\n--- a/docs/advanced/ssl.md\n+++ b/docs/advanced/ssl.md\n@@ -14,7 +14,7 @@ You can configure the verification using `httpx.SSLContext()`.\n ```pycon\n >>> ssl_context = httpx.SSLContext()\n >>> ssl_context\n-<SSLContext [verify=True]>\n+SSLContext(verify=True)\n >>> httpx.get(\"https://www.example.com\", ssl_context=ssl_context)\n httpx.ConnectError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:997)\n ```\n@@ -24,7 +24,7 @@ For example, you can use this to disable verification completely and allow insec\n ```pycon\n >>> no_verify = httpx.SSLContext(verify=False)\n >>> no_verify\n-<SSLContext [verify=False]>\n+SSLContext(verify=False)\n >>> httpx.get(\"https://expired.badssl.com/\", ssl_context=no_verify)\n <Response [200 OK]>\n ```\ndiff --git a/httpx/_config.py b/httpx/_config.py\nindex 303388d..8cfeea7 100644\n--- a/httpx/_config.py\n+++ b/httpx/_config.py\n@@ -136,7 +136,9 @@ class SSLContext(ssl.SSLContext):\n                 )\n \n     def __repr__(self) -> str:\n-        return f\"<SSLContext [verify={self.verify}]>\"\n+        class_name = self.__class__.__name__\n+\n+        return f\"{class_name}(verify={self.verify!r})\"\n \n     def __new__(\n         cls,\ndiff --git a/tests/test_config.py b/tests/test_config.py\nindex 530b150..b39efa8 100644\n--- a/tests/test_config.py\n+++ b/tests/test_config.py\n@@ -74,6 +74,16 @@ def test_SSLContext_with_get_request(server, cert_pem_file):\n     assert response.status_code == 200\n \n \n+def test_SSLContext_repr():\n+    ssl_context = httpx.SSLContext()\n+\n+    assert repr(ssl_context) == \"SSLContext(verify=True)\"\n+\n+    ssl_context = httpx.SSLContext(verify=certifi.where())\n+\n+    assert repr(ssl_context) == \"SSLContext(verify='{}')\".format(certifi.where())\n+\n+\n def test_limits_repr():\n     limits = httpx.Limits(max_connections=100)\n     expected = (\n", "difficulty": 3, "changed_files": ["docs/advanced/ssl.md", "httpx/_config.py", "tests/test_config.py"], "commit_link": "https://github.com/encode/httpx/tree/7f351340260c165e18ccd7c83dc783bb371b3797"}