python3Packages.py-synologydsm-api: enable tests

Download sources from GitHub since PyPI package doesn't contain tests.
This commit is contained in:
Nikita Uvarov 2021-10-21 22:34:10 +02:00
parent bc21d9d231
commit 0d94eb0a05
No known key found for this signature in database
GPG Key ID: D3C4D7873B85C975

View File

@ -1,6 +1,8 @@
{ lib
, buildPythonPackage
, fetchPypi
, fetchFromGitHub
, pytestCheckHook
, poetry-core
, urllib3
, requests
}:
@ -8,18 +10,25 @@
buildPythonPackage rec {
pname = "py-synologydsm-api";
version = "1.0.2";
format = "pyproject";
src = fetchPypi {
pname = "synologydsm-api";
inherit version;
sha256 = "42ea453ef5734dd5b8163e3d18ef309658f0298411720e6b834bededd28c5d53";
src = fetchFromGitHub {
owner = "hacf-fr";
repo = "synologydsm-api";
rev = "v${version}";
sha256 = "sha256-UQdPwvRdv7SCOTxkA1bfskQ9oL/DB0j1TdJE04ODyj8=";
};
nativeBuildInputs = [ poetry-core ];
propagatedBuildInputs = [ urllib3 requests ];
pythonImportsCheck = [ "synology_dsm" ];
checkInputs = [ pytestCheckHook ];
pythonImportsCheck = [
"synology_dsm"
];
postPatch = ''
# was fixed upstream but not released, remove after upgrade to version > 1.0.2
substituteInPlace pyproject.toml \
--replace "poetry.masonry.api" "poetry.core.masonry.api"
'';
meta = with lib; {
description = "Python API for Synology DSM";