Группа :: Development/Python3
Пакет: python3-module-requests
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: python3-module-requests-2.31.0-alt.patch
Скачать
Скачать
requests/certs.py | 8 +++++++-
setup.py | 1 -
tests/test_lowlevel.py | 18 ++++++++++++++++++
tests/test_requests.py | 10 +++++++++-
4 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/requests/certs.py b/requests/certs.py
index be422c3e..54c73aaa 100644
--- a/requests/certs.py
+++ b/requests/certs.py
@@ -10,8 +10,14 @@ only one Б─■ the one from the certifi package.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
+
+This Fedora-patched package returns "/etc/pki/tls/certs/ca-bundle.crt" provided
+by the ca-certificates RPM package.
"""
-from certifi import where
+def where():
+ """Return the absolute path to the system CA bundle."""
+ return '/etc/pki/tls/certs/ca-bundle.crt'
+
if __name__ == "__main__":
print(where())
diff --git a/setup.py b/setup.py
index 01235457..ec3fd1d2 100755
--- a/setup.py
+++ b/setup.py
@@ -62,7 +62,6 @@ requires = [
"charset_normalizer>=2,<4",
"idna>=2.5,<4",
"urllib3>=1.21.1,<3",
- "certifi>=2017.4.17",
]
test_requirements = [
"pytest-httpbin==2.0.0",
diff --git a/tests/test_lowlevel.py b/tests/test_lowlevel.py
index 859d07e8..808a6b85 100644
--- a/tests/test_lowlevel.py
+++ b/tests/test_lowlevel.py
@@ -286,7 +286,25 @@ for prefix, schemes in _schemes_by_var_prefix:
_proxy_combos += [(var.upper(), scheme) for var, scheme in _proxy_combos]
+def has_eventlet():
+ try:
+ import eventlet
+ except ImportError:
+ pass
+ else:
+ return True
+ return False
+
+
@pytest.mark.parametrize("var,scheme", _proxy_combos)
+@pytest.mark.xfail(
+ has_eventlet(),
+ reason=(
+ "eventlet conflicts with pysocks: "
+ "https://github.com/eventlet/eventlet/issues/616"
+ ),
+ strict=True,
+)
def test_use_proxy_from_environment(httpbin, var, scheme):
url = f"{scheme}://httpbin.org"
fake_proxy = Server() # do nothing with the requests; just close the socket
diff --git a/tests/test_requests.py b/tests/test_requests.py
index b420c44d..0e962321 100644
--- a/tests/test_requests.py
+++ b/tests/test_requests.py
@@ -985,7 +985,7 @@ class TestRequests:
)
def test_env_cert_bundles(self, httpbin, mocker, env, expected):
s = requests.Session()
- mocker.patch("os.environ", env)
+ mocker.patch("requests.sessions.os.environ", env)
settings = s.merge_environment_settings(
url=httpbin("get"), proxies={}, stream=False, verify=True, cert=None
)
@@ -2478,6 +2478,10 @@ class TestTimeout:
@pytest.mark.parametrize(
"timeout", ((0.1, None), Urllib3Timeout(connect=0.1, read=None))
)
+ @pytest.mark.skipif(
+ os.environ.get("NO_INTERNET") is not None,
+ reason="Requires configured network",
+ )
def test_connect_timeout(self, timeout):
try:
requests.get(TARPIT, timeout=timeout)
@@ -2489,6 +2493,10 @@ class TestTimeout:
@pytest.mark.parametrize(
"timeout", ((0.1, 0.1), Urllib3Timeout(connect=0.1, read=0.1))
)
+ @pytest.mark.skipif(
+ os.environ.get("NO_INTERNET") is not None,
+ reason="Requires configured network",
+ )
def test_total_timeout_connect(self, timeout):
try:
requests.get(TARPIT, timeout=timeout)