mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-02-12 11:21:50 +01:00
Update test url used in `tests/url_socket.py` tests to fix test errors.
```
def test_disable_socket_urllib():
> assert urlopen('https://httpstat.us/200').getcode() == 200
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test_urllib_succeeds_by_default.py:7:
[...]
def _read_status(self):
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
if len(line) > _MAXLINE:
raise LineTooLong("status line")
if self.debuglevel > 0:
print("reply:", repr(line))
if not line:
# Presumably, the server closed the connection before
# sending a valid response.
> raise RemoteDisconnected("Remote end closed connection without"
" response")
E http.client.RemoteDisconnected: Remote end closed connection without response
/usr/lib/python3.12/http/client.py:300: RemoteDisconnected
[...]
FAILED tests/test_socket.py::test_urllib_succeeds_by_default - AssertionError...
FAILED tests/test_socket.py::test_enabled_urllib_succeeds - AssertionError: a...
```
43 lines
1.6 KiB
Diff
43 lines
1.6 KiB
Diff
Patch-Source: https://github.com/miketheman/pytest-socket/commit/ac1ccfe9d4d4dca4d7763e660c350510f9134c42
|
|
---
|
|
From ac1ccfe9d4d4dca4d7763e660c350510f9134c42 Mon Sep 17 00:00:00 2001
|
|
From: Mike Fiedler <miketheman@gmail.com>
|
|
Date: Sun, 13 Jul 2025 17:46:07 -0400
|
|
Subject: [PATCH] test: update real service to one that lives on (#426)
|
|
|
|
---
|
|
tests/test_socket.py | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/tests/test_socket.py b/tests/test_socket.py
|
|
index de8e877..13e1817 100644
|
|
--- a/tests/test_socket.py
|
|
+++ b/tests/test_socket.py
|
|
@@ -149,7 +149,7 @@ def test_urllib_succeeds_by_default(testdir):
|
|
from urllib2 import urlopen
|
|
|
|
def test_disable_socket_urllib():
|
|
- assert urlopen('https://httpstat.us/200').getcode() == 200
|
|
+ assert urlopen('https://http.codes/200').getcode() == 200
|
|
"""
|
|
)
|
|
result = testdir.runpytest()
|
|
@@ -170,7 +170,7 @@ def test_enabled_urllib_succeeds(testdir):
|
|
|
|
@pytest.mark.enable_socket
|
|
def test_disable_socket_urllib():
|
|
- assert urlopen('https://httpstat.us/200').getcode() == 200
|
|
+ assert urlopen('https://http.codes/200').getcode() == 200
|
|
"""
|
|
)
|
|
result = testdir.runpytest("--disable-socket")
|
|
@@ -190,7 +190,7 @@ def test_disabled_urllib_fails(testdir):
|
|
|
|
@pytest.mark.disable_socket
|
|
def test_disable_socket_urllib():
|
|
- assert urlopen('https://httpstat.us/200').getcode() == 200
|
|
+ assert urlopen('https://http.codes/200').getcode() == 200
|
|
"""
|
|
)
|
|
result = testdir.runpytest()
|