From 3396b16c4ed4cda1a03ad469053b1a464671f596 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Fri, 30 Dec 2022 20:12:55 +0100 Subject: [PATCH] python3Packages.async-modbus: 0.2.0 -> 0.2.1 --- .../python-modules/async-modbus/default.nix | 13 +++- .../async-modbus/fix-tests.patch | 73 +++++++++++++++++++ 2 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/python-modules/async-modbus/fix-tests.patch diff --git a/pkgs/development/python-modules/async-modbus/default.nix b/pkgs/development/python-modules/async-modbus/default.nix index 84423c6afbbc..afeb78d413a7 100644 --- a/pkgs/development/python-modules/async-modbus/default.nix +++ b/pkgs/development/python-modules/async-modbus/default.nix @@ -2,6 +2,7 @@ , buildPythonPackage , connio , fetchFromGitHub +, fetchpatch , pytest-asyncio , pytestCheckHook , pythonOlder @@ -11,7 +12,7 @@ buildPythonPackage rec { pname = "async-modbus"; - version = "0.2.0"; + version = "0.2.1"; format = "pyproject"; disabled = pythonOlder "3.7"; @@ -20,9 +21,17 @@ buildPythonPackage rec { owner = "tiagocoutinho"; repo = "async_modbus"; rev = "refs/tags/v${version}"; - hash = "sha256-TB+ndUvLZ9G3XXEBpLb4ULHlYZC2CoqGnL2BjMQrhRg="; + hash = "sha256-OTt/rUa3KLVSFOIUyMNHnqHvPtISxTposNFAgoixRfk="; }; + patches = [ + (fetchpatch { + # Fix tests; https://github.com/tiagocoutinho/async_modbus/pull/13 + url = "https://github.com/tiagocoutinho/async_modbus/commit/d81d8ffe94870f0f505e0c8a0694768c98053ecc.patch"; + hash = "sha256-mG3XO2nAFYitatkswU7er29BJc/A0IL1rL2Zu4daZ7k="; + }) + ]; + postPatch = '' substituteInPlace pyproject.toml \ --replace '"--cov=async_modbus",' "" \ diff --git a/pkgs/development/python-modules/async-modbus/fix-tests.patch b/pkgs/development/python-modules/async-modbus/fix-tests.patch new file mode 100644 index 000000000000..1c9dd605f5b8 --- /dev/null +++ b/pkgs/development/python-modules/async-modbus/fix-tests.patch @@ -0,0 +1,73 @@ +diff --git a/tests/test_async_modbus.py b/tests/test_async_modbus.py +index b0bd3fd..6b8df87 100644 +--- a/tests/test_async_modbus.py ++++ b/tests/test_async_modbus.py +@@ -194,7 +194,7 @@ async def test_read_coils(proto, slave_id, starting_address, expected_reply): + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply + + server = Server(slave_id, starting_address, expected_reply) + client = AsyncClient(server, protocol) +@@ -204,7 +204,7 @@ async def test_read_coils(proto, slave_id, starting_address, expected_reply): + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply + + + @pytest.mark.asyncio +@@ -273,7 +273,7 @@ async def test_read_discrete_inputs(proto, slave_id, starting_address, expected_ + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply + + server = Server(slave_id, starting_address, expected_reply) + client = AsyncClient(server, protocol) +@@ -283,7 +283,7 @@ async def test_read_discrete_inputs(proto, slave_id, starting_address, expected_ + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply + + + @pytest.mark.asyncio +@@ -306,7 +306,7 @@ async def test_read_holding_registers( + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply + + server = Server(slave_id, starting_address, expected_reply) + client = AsyncClient(server, protocol) +@@ -316,7 +316,7 @@ async def test_read_holding_registers( + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply + + + @pytest.mark.asyncio +@@ -383,7 +383,7 @@ async def test_read_input_registers(proto, slave_id, starting_address, expected_ + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply + + server = Server(slave_id, starting_address, expected_reply) + client = AsyncClient(server, protocol) +@@ -393,4 +393,4 @@ async def test_read_input_registers(proto, slave_id, starting_address, expected_ + await coro + else: + reply = await coro +- assert (reply == expected_reply).all() ++ assert reply == expected_reply