diff --git a/pkgs/development/python-modules/amqtt/default.nix b/pkgs/development/python-modules/amqtt/default.nix index 892046908c4a..7458ca11e99d 100644 --- a/pkgs/development/python-modules/amqtt/default.nix +++ b/pkgs/development/python-modules/amqtt/default.nix @@ -2,9 +2,11 @@ , buildPythonPackage , docopt , fetchFromGitHub +, fetchpatch , hypothesis , passlib , poetry-core +, pytest-logdog , pytest-asyncio , pytestCheckHook , pythonOlder @@ -15,24 +17,21 @@ buildPythonPackage rec { pname = "amqtt"; - version = "0.10.0"; + version = "unstable-2022-01-11"; format = "pyproject"; + disabled = pythonOlder "3.7"; src = fetchFromGitHub { owner = "Yakifo"; repo = pname; - rev = "v${version}"; - sha256 = "sha256-27LmNR1KC8w3zRJ7YBlBolQ4Q70ScTPqypMCpU6fO+I="; + rev = "8961b8fff57007a5d9907b98bc555f0519974ce9"; + hash = "sha256-3uwz4RSoa6KRC8mlVfeIMLPH6F2kOJjQjjXCrnVX0Jo="; }; - postPatch = '' - substituteInPlace pyproject.toml \ - --replace 'websockets = "^9.0"' 'websockets = "^10.0"' \ - --replace 'PyYAML = "^5.4.0"' 'PyYAML = "*"' \ - ''; - - nativeBuildInputs = [ poetry-core ]; + nativeBuildInputs = [ + poetry-core + ]; propagatedBuildInputs = [ docopt @@ -44,22 +43,30 @@ buildPythonPackage rec { checkInputs = [ hypothesis + pytest-logdog pytest-asyncio pytestCheckHook ]; + postPatch = '' + substituteInPlace pyproject.toml \ + --replace 'PyYAML = "^5.4.0"' 'PyYAML = "*"' + ''; + disabledTestPaths = [ # Test are not ported from hbmqtt yet "tests/test_cli.py" "tests/test_client.py" ]; - disabledTests = [ - # Requires network access - "test_connect_tcp" - ]; + preCheck = '' + # Some tests need amqtt + export PATH=$out/bin:$PATH + ''; - pythonImportsCheck = [ "amqtt" ]; + pythonImportsCheck = [ + "amqtt" + ]; meta = with lib; { description = "Python MQTT client and broker implementation"; diff --git a/pkgs/development/python-modules/pytest-logdog/default.nix b/pkgs/development/python-modules/pytest-logdog/default.nix new file mode 100644 index 000000000000..c626a1cfac9e --- /dev/null +++ b/pkgs/development/python-modules/pytest-logdog/default.nix @@ -0,0 +1,49 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, pytest +, pytestCheckHook +, pythonOlder +, setuptools-scm +}: + +buildPythonPackage rec { + pname = "pytest-logdog"; + version = "0.1.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; + + src = fetchFromGitHub { + owner = "ods"; + repo = pname; + rev = version; + hash = "sha256-Tmoq+KAGzn0MMj29rukDfAc4LSIwC8DoMTuBAppV32I="; + }; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; + + nativeBuildInputs = [ + setuptools-scm + ]; + + buildInputs = [ + pytest + ]; + + + checkInputs = [ + pytestCheckHook + ]; + + pythonImportsCheck = [ + "pytest_logdog" + ]; + + meta = with lib; { + description = "Pytest plugin to test logging"; + homepage = "https://github.com/ods/pytest-logdog"; + license = licenses.mit; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/development/python-modules/roombapy/default.nix b/pkgs/development/python-modules/roombapy/default.nix index 2a97993669f1..dff19589dcc4 100644 --- a/pkgs/development/python-modules/roombapy/default.nix +++ b/pkgs/development/python-modules/roombapy/default.nix @@ -37,6 +37,12 @@ buildPythonPackage rec { pytestCheckHook ]; + postPatch = '' + # hbmqtt was replaced by amqtt + substituteInPlace tests/test_roomba_integration.py \ + --replace "from hbmqtt.broker import Broker" "from amqtt.broker import Broker" + ''; + disabledTestPaths = [ # Requires network access "tests/test_discovery.py" diff --git a/pkgs/development/python-modules/transitions/default.nix b/pkgs/development/python-modules/transitions/default.nix index 0dca476debf0..76a82e7c6213 100644 --- a/pkgs/development/python-modules/transitions/default.nix +++ b/pkgs/development/python-modules/transitions/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, pythonAtLeast , six , pygraphviz , pytestCheckHook @@ -13,6 +14,7 @@ buildPythonPackage rec { pname = "transitions"; version = "0.8.10"; + format = "setuptools"; src = fetchPypi { inherit pname version; @@ -36,6 +38,16 @@ buildPythonPackage rec { export HOME=$TMPDIR ''; + disabledTests = lib.optionals (pythonAtLeast "3.10") [ + # https://github.com/pytransitions/transitions/issues/563 + "test_multiple_models" + "test_timeout" + ]; + + pythonImportsCheck = [ + "transitions" + ]; + meta = with lib; { homepage = "https://github.com/pytransitions/transitions"; description = "A lightweight, object-oriented finite state machine implementation in Python"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 8af4c25e4dff..83f068845ae9 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7692,6 +7692,8 @@ in { pytest-localserver = callPackage ../development/python-modules/pytest-localserver { }; + pytest-logdog = callPackage ../development/python-modules/pytest-logdog{ }; + pytest-metadata = callPackage ../development/python-modules/pytest-metadata { }; pytest-mock = callPackage ../development/python-modules/pytest-mock { };