From 7b12ac7d5813513c658770e2ca1d3d57662369f1 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Thu, 7 Apr 2022 05:02:38 +0200 Subject: [PATCH] python3Packages.samsungtvws: enable tests, split off extras --- .../python-modules/samsungtvws/default.nix | 51 +++++++++++++++---- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/samsungtvws/default.nix b/pkgs/development/python-modules/samsungtvws/default.nix index 05dc36947650..383841caffa4 100644 --- a/pkgs/development/python-modules/samsungtvws/default.nix +++ b/pkgs/development/python-modules/samsungtvws/default.nix @@ -1,29 +1,62 @@ -{ lib, buildPythonPackage, fetchPypi, isPy27 -, aiohttp +{ lib +, buildPythonPackage +, fetchFromGitHub +, isPy27 + +# propagates: , requests , websocket-client + +# extras: async +, aiohttp , websockets + +# extras: encrypted +, cryptography +, py3rijndael + +# tests +, aioresponses +, pytest-asyncio +, pytestCheckHook }: buildPythonPackage rec { pname = "samsungtvws"; version = "2.5.0"; + format = "setuptools"; disabled = isPy27; - src = fetchPypi { - inherit pname version; - sha256 = "sha256-AFCN1b80GZ24g3oWe1qqc72yWQy4+/sorL8zwOYM7vo="; + src = fetchFromGitHub { + owner = "xchwarze"; + repo = "samsung-tv-ws-api"; + rev = "v${version}"; + hash = "sha256-AimG5tyTRBETpivC2BwCuoR4o7y98YT6u5sogJlcmoo="; }; propagatedBuildInputs = [ - aiohttp requests websocket-client - websockets ]; - # no tests - doCheck = false; + passthru.extras-require = { + async = [ + aiohttp + websockets + ]; + encrypted = [ + cryptography + py3rijndael + ]; + }; + + checkInputs = [ + aioresponses + pytest-asyncio + pytestCheckHook + ] + ++ passthru.extras-require.async + ++ passthru.extras-require.encrypted; pythonImportsCheck = [ "samsungtvws" ];