Skip to content

Commit b0d5e02

Browse files
committed
Merge fixes
1 parent 128cd92 commit b0d5e02

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

adafruit_connection_manager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def get_radio_socketpool(radio):
150150
import ssl # pylint: disable=import-outside-toplevel
151151

152152
ssl_context = ssl.create_default_context()
153-
pool.set_interface(radio)
154153
except ImportError:
155154
# if SSL not on board, default to fake_ssl_context
156155
pass

tests/conftest.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@
1010
import pytest
1111

1212

13-
# pylint: disable=unused-argument
14-
def set_interface(iface):
15-
"""Helper to set the global internet interface"""
16-
17-
1813
class SocketPool:
1914
name = None
2015

@@ -32,6 +27,14 @@ class ESP32SPI_SocketPool(SocketPool): # pylint: disable=too-few-public-methods
3227

3328
class WIZNET5K_SocketPool(SocketPool): # pylint: disable=too-few-public-methods
3429
name = "adafruit_wiznet5k_socketpool"
30+
SOCK_STREAM = 0x21
31+
32+
33+
class WIZNET5K_With_SSL_SocketPool(
34+
SocketPool
35+
): # pylint: disable=too-few-public-methods
36+
name = "adafruit_wiznet5k_socketpool"
37+
SOCK_STREAM = 0x1
3538

3639

3740
@pytest.fixture
@@ -62,7 +65,6 @@ def adafruit_wiznet5k_socketpool_module():
6265
wiznet5k_module = type(sys)("adafruit_wiznet5k")
6366
wiznet5k_socketpool_module = type(sys)("adafruit_wiznet5k_socketpool")
6467
wiznet5k_socketpool_module.SocketPool = WIZNET5K_SocketPool
65-
wiznet5k_socketpool_module.SOCK_STREAM = 0x21
6668
sys.modules["adafruit_wiznet5k"] = wiznet5k_module
6769
sys.modules["adafruit_wiznet5k.adafruit_wiznet5k_socketpool"] = (
6870
wiznet5k_socketpool_module
@@ -73,16 +75,17 @@ def adafruit_wiznet5k_socketpool_module():
7375

7476

7577
@pytest.fixture
76-
def adafruit_wiznet5k_with_ssl_socket_module():
78+
def adafruit_wiznet5k_with_ssl_socketpool_module():
7779
wiznet5k_module = type(sys)("adafruit_wiznet5k")
78-
wiznet5k_socket_module = type(sys)("adafruit_wiznet5k_socket")
79-
wiznet5k_socket_module.set_interface = set_interface
80-
wiznet5k_socket_module.SOCK_STREAM = 1
80+
wiznet5k_socketpool_module = type(sys)("adafruit_wiznet5k_socketpool")
81+
wiznet5k_socketpool_module.SocketPool = WIZNET5K_With_SSL_SocketPool
8182
sys.modules["adafruit_wiznet5k"] = wiznet5k_module
82-
sys.modules["adafruit_wiznet5k.adafruit_wiznet5k_socket"] = wiznet5k_socket_module
83+
sys.modules["adafruit_wiznet5k.adafruit_wiznet5k_socketpool"] = (
84+
wiznet5k_socketpool_module
85+
)
8386
yield
8487
del sys.modules["adafruit_wiznet5k"]
85-
del sys.modules["adafruit_wiznet5k.adafruit_wiznet5k_socket"]
88+
del sys.modules["adafruit_wiznet5k.adafruit_wiznet5k_socketpool"]
8689

8790

8891
@pytest.fixture(autouse=True)

tests/get_connection_manager_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_get_connection_manager():
1919

2020

2121
def test_different_connection_manager_different_pool( # pylint: disable=unused-argument
22-
circuitpython_socketpool_module, adafruit_esp32spi_socket_module
22+
circuitpython_socketpool_module, adafruit_esp32spi_socketpool_module
2323
):
2424
radio_wifi = mocket.MockRadio.Radio()
2525
radio_esp = mocket.MockRadio.ESP_SPIcontrol()

tests/ssl_context_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_connect_wiznet5k_https_not_supported( # pylint: disable=unused-argumen
6666

6767

6868
def test_connect_wiznet5k_https_supported( # pylint: disable=unused-argument
69-
adafruit_wiznet5k_with_ssl_socket_module,
69+
adafruit_wiznet5k_with_ssl_socketpool_module,
7070
):
7171
radio = mocket.MockRadio.WIZNET5K()
7272
with mock.patch("sys.implementation", (None, WIZNET5K_SSL_SUPPORT_VERSION)):

0 commit comments

Comments
 (0)