From 5a2dfc226b5350f70adc790f9650217351540121 Mon Sep 17 00:00:00 2001 From: nepoz Date: Fri, 9 Jul 2021 00:58:09 -0500 Subject: [PATCH] Removed dependency on pytest-socket for the Network module's unit tests. --- tests/modules/contrib/test_network.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/modules/contrib/test_network.py b/tests/modules/contrib/test_network.py index 9b270bf..05ec3b1 100644 --- a/tests/modules/contrib/test_network.py +++ b/tests/modules/contrib/test_network.py @@ -39,8 +39,9 @@ class TestNetworkUnit(TestCase): def test_load_module(self): __import__("modules.contrib.network") - @pytest.mark.allow_hosts(["127.0.0.1"]) - def test_no_internet(self): + @mock.patch("socket.create_connection") + def test_no_internet(self, socket_mock): + socket_mock.side_effect = Exception() module = build_module() assert module.widgets()[0].full_text() == "No connection"