From adb3847a9aba5275b7168d7cdb43eb694899e342 Mon Sep 17 00:00:00 2001 From: gfrn Date: Mon, 12 Sep 2022 10:47:50 -0300 Subject: [PATCH] Fixes mock socket in unit tests --- tests/unit/test_read_vars_common.py | 4 +++- tests/unit/test_read_vars_fac.py | 4 +++- tests/unit/test_read_vars_fap.py | 4 +++- tests/unit/test_read_vars_fbp.py | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_read_vars_common.py b/tests/unit/test_read_vars_common.py index a1c3f49..de34c97 100644 --- a/tests/unit/test_read_vars_common.py +++ b/tests/unit/test_read_vars_common.py @@ -7,8 +7,10 @@ class TestCommon(unittest.TestCase): + @patch("socket.socket") @patch("pydrs.EthDRS._transfer") - def setUp(self, transfer): + def setUp(self, transfer, socket): + socket = socket.return_value self.drs = GenericDRS("127.0.0.1", 5000) self.drs._transfer = transfer diff --git a/tests/unit/test_read_vars_fac.py b/tests/unit/test_read_vars_fac.py index fc75bca..218def4 100644 --- a/tests/unit/test_read_vars_fac.py +++ b/tests/unit/test_read_vars_fac.py @@ -7,8 +7,10 @@ class TestFAC(unittest.TestCase): + @patch("socket.socket") @patch("pydrs.EthDRS._transfer") - def setUp(self, transfer): + def setUp(self, transfer, socket): + socket = socket.return_value self.drs = GenericDRS("127.0.0.1", 5000) self.drs._transfer = transfer diff --git a/tests/unit/test_read_vars_fap.py b/tests/unit/test_read_vars_fap.py index fdd3e03..2ff094c 100644 --- a/tests/unit/test_read_vars_fap.py +++ b/tests/unit/test_read_vars_fap.py @@ -7,8 +7,10 @@ class TestFAP(unittest.TestCase): + @patch("socket.socket") @patch("pydrs.EthDRS._transfer") - def setUp(self, transfer): + def setUp(self, transfer, socket): + socket = socket.return_value self.drs = GenericDRS("127.0.0.1", 5000) self.drs._transfer = transfer diff --git a/tests/unit/test_read_vars_fbp.py b/tests/unit/test_read_vars_fbp.py index 72a84f1..caff84b 100644 --- a/tests/unit/test_read_vars_fbp.py +++ b/tests/unit/test_read_vars_fbp.py @@ -7,8 +7,10 @@ class TestFBP(unittest.TestCase): + @patch("socket.socket") @patch("pydrs.EthDRS._transfer") - def setUp(self, transfer): + def setUp(self, transfer, socket): + socket = socket.return_value self.drs = GenericDRS("127.0.0.1", 5000) self.drs._transfer = transfer