diff --git a/pkgs/development/python-modules/mirakuru/default.nix b/pkgs/development/python-modules/mirakuru/default.nix index e208daa625ef..58c74cd3cad1 100644 --- a/pkgs/development/python-modules/mirakuru/default.nix +++ b/pkgs/development/python-modules/mirakuru/default.nix @@ -1,4 +1,5 @@ { + stdenv, lib, buildPythonPackage, fetchFromGitHub, @@ -13,18 +14,23 @@ buildPythonPackage rec { pname = "mirakuru"; - version = "2.5.2"; + version = "2.5.3"; format = "pyproject"; - disabled = pythonOlder "3.8"; + disabled = pythonOlder "3.9"; src = fetchFromGitHub { owner = "ClearcodeHQ"; repo = "mirakuru"; rev = "refs/tags/v${version}"; - hash = "sha256-I1TKP0ESuBMTcReZf0tryjvGpSpwzofwmOiQqhyr6Zg="; + hash = "sha256-blk4Oclb3+Cj3RH7BhzacfoPFDBIP/zgv4Ct7fawGnQ="; }; + patches = [ + # https://github.com/ClearcodeHQ/mirakuru/pull/810 + ./tmpdir.patch + ]; + nativeBuildInputs = [ setuptools ]; propagatedBuildInputs = [ psutil ]; @@ -37,6 +43,20 @@ buildPythonPackage rec { ]; pythonImportsCheck = [ "mirakuru" ]; + # Necessary for the tests to pass on Darwin with sandbox enabled. + __darwinAllowLocalNetworking = true; + + # Those are failing in the darwin sandbox with: + # > ps: %mem: requires entitlement + # > ps: vsz: requires entitlement + # > ps: rss: requires entitlement + # > ps: time: requires entitlement + disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [ + "test_forgotten_stop" + "test_mirakuru_cleanup" + "test_daemons_killing" + ]; + meta = with lib; { homepage = "https://pypi.org/project/mirakuru"; description = "Process orchestration tool designed for functional and integration tests"; diff --git a/pkgs/development/python-modules/mirakuru/tmpdir.patch b/pkgs/development/python-modules/mirakuru/tmpdir.patch new file mode 100644 index 000000000000..2fd6fcfd2741 --- /dev/null +++ b/pkgs/development/python-modules/mirakuru/tmpdir.patch @@ -0,0 +1,19 @@ +--- a/tests/executors/test_unixsocket_executor.py ++++ b/tests/executors/test_unixsocket_executor.py +@@ -4,6 +4,7 @@ Some of these tests run ``nc``: when running Debian, make sure the + ``netcat-openbsd`` package is used, not ``netcat-traditional``. + """ + ++import os + import sys + + import pytest +@@ -12,7 +13,7 @@ from mirakuru import TimeoutExpired + from mirakuru.unixsocket import UnixSocketExecutor + from tests import TEST_SOCKET_SERVER_PATH + +-SOCKET_PATH = "/tmp/mirakuru.sock" ++SOCKET_PATH = os.path.join(os.getenv("TMPDIR", "/tmp"), "mirakuru.sock") + + SOCKET_SERVER_CMD = f"{sys.executable} {TEST_SOCKET_SERVER_PATH} {SOCKET_PATH}" + diff --git a/pkgs/development/python-modules/pgsanity/default.nix b/pkgs/development/python-modules/pgsanity/default.nix index 7f1c482977a3..df957c92c686 100644 --- a/pkgs/development/python-modules/pgsanity/default.nix +++ b/pkgs/development/python-modules/pgsanity/default.nix @@ -20,6 +20,9 @@ buildPythonPackage rec { unittestCheckHook postgresql ]; + + unittestFlagsArray = [ "test" ]; + propagatedBuildInputs = [ postgresql ]; meta = with lib; {