From d875fa73ca418bd1d73b5dba9d785513fbc7dabd Mon Sep 17 00:00:00 2001 From: arcnmx Date: Thu, 25 Jan 2024 08:19:37 -0800 Subject: [PATCH] fix(hass): more consistent builds --- modules/nixos/home-assistant.nix | 14 +++++++++++--- packages/mpd2-skip-flaky-test.patch | 13 +++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 packages/mpd2-skip-flaky-test.patch diff --git a/modules/nixos/home-assistant.nix b/modules/nixos/home-assistant.nix index 77f820a2..e65b81a4 100644 --- a/modules/nixos/home-assistant.nix +++ b/modules/nixos/home-assistant.nix @@ -7,7 +7,7 @@ cfg = config.services.home-assistant; inherit (lib.modules) mkIf mkMerge mkBefore mkDefault; inherit (lib.options) mkOption mkEnableOption; - inherit (lib.lists) optional optionals elem; + inherit (lib.lists) optional optionals elem unique; inherit (lib.strings) toLower; in { options.services.home-assistant = with lib.types; { @@ -152,13 +152,21 @@ in { then lib.warn "brother override no longer needed" true else true; }); + mpd2 = super.mpd2.overridePythonAttrs (old: { + patches = old.patches or [ ] ++ [ + ../../packages/mpd2-skip-flaky-test.patch + ]; + disabledTests = unique (old.disabledTests or [ ] ++ [ + "test_idle_timeout" + ]); + }); }; }; in home-assistant.overrideAttrs (old: { makeWrapperArgs = old.makeWrapperArgs ++ optional (cfg.brother.enable && needsPyasn1pin) "--prefix PYTHONPATH : ${pyasn1prefix}"; - disabledTests = old.disabledTests or [ ] ++ [ + disabledTests = unique (old.disabledTests or [ ] ++ [ "test_check_config" - ]; + ]); }); extraPackages = python3Packages: with python3Packages; mkMerge [ [ diff --git a/packages/mpd2-skip-flaky-test.patch b/packages/mpd2-skip-flaky-test.patch new file mode 100644 index 00000000..578762d3 --- /dev/null +++ b/packages/mpd2-skip-flaky-test.patch @@ -0,0 +1,13 @@ +diff --git a/mpd/tests.py b/mpd/tests.py +index 9789c86..469133e 100755 +--- a/mpd/tests.py ++++ b/mpd/tests.py +@@ -1555,7 +1555,7 @@ class TestAsyncioMPD(unittest.IsolatedAsyncioTestCase): + self.client.disconnect() + + @unittest.skipIf( +- sys.version_info >= (3, 12), ++ sys.version_info >= (3, 11), + "In Python 3.12 we see a timeout error triggering idle instead of the bug described in https://github.com/Mic92/python-mpd2/pull/199", + ) + async def test_idle_timeout(self) -> None: