2021-03-10 12:37:13 +01:00
{ lib
, buildPythonPackage
, fetchFromGitHub
, pythonOlder
, python
, py-multiaddr
, requests
, pytestCheckHook
, pytest-cov
, pytest-dependency
, pytest-localserver
, pytest-mock
, pytest-order
, pytest-cid
, mock
, ipfs
, httpx
, httpcore
} :
buildPythonPackage rec {
pname = " i p f s h t t p c l i e n t " ;
2021-06-30 02:16:06 +02:00
version = " 0 . 8 . 0 a 2 " ;
2021-03-10 12:37:13 +01:00
format = " f l i t " ;
2021-06-30 02:16:06 +02:00
disabled = pythonOlder " 3 . 6 " ;
2021-03-10 12:37:13 +01:00
src = fetchFromGitHub {
owner = " i p f s - s h i p y a r d " ;
repo = " p y - i p f s - h t t p - c l i e n t " ;
rev = version ;
2021-06-30 02:16:06 +02:00
sha256 = " s h a 2 5 6 - O m C 6 7 p N 2 B b u G w M 4 3 x N D K l s L h w V e U b p v f O a z y I D v o M E A = " ;
2021-03-10 12:37:13 +01:00
} ;
propagatedBuildInputs = [
py-multiaddr
requests
] ;
checkInputs = [
pytestCheckHook
pytest-cov
pytest-dependency
pytest-localserver
pytest-mock
pytest-order
pytest-cid
mock
ipfs
httpcore
httpx
] ;
postPatch = ''
2021-06-30 02:16:06 +02:00
# This can be removed for the 0.8.0 release
2021-03-10 12:37:13 +01:00
# Use pytest-order instead of pytest-ordering since the latter is unmaintained and broken
substituteInPlace test/run-tests.py \
- - replace ' pytest_ordering' ' pytest_order'
substituteInPlace test/functional/test_miscellaneous.py \
- - replace ' @ pytest . mark . last' ' @ pytest . mark . order ( " l a s t " ) '
2021-12-16 02:44:31 +01:00
# Until a proper fix is created, just skip these tests
# and ignore any breakage that may result from the API change in IPFS
# See https://github.com/ipfs-shipyard/py-ipfs-http-client/issues/308
substituteInPlace test/functional/test_pubsub.py \
- - replace ' # the message that will be published' 'pytest.skip("This test fails because of an incompatibility with the experimental PubSub feature in IPFS>=0.11.0")' \
- - replace ' # subscribe to the topic testing' 'pytest.skip("This test fails because of an incompatibility with the experimental PubSub feature in IPFS>=0.11.0")'
2021-12-16 17:42:16 +01:00
substituteInPlace test/functional/test_other.py \
- - replace ' import ipfshttpclient' ' import ipfshttpclient ; import pytest' \
- - replace ' assert ipfs_is_available' ' pytest . skip ( " U n k n o w n t e s t f a i l u r e w i t h I P F S > = 0 . 1 1 . 0 " ) ; assert ipfs_is_available'
substituteInPlace test/run-tests.py \
- - replace ' - - cov-fail-under = 9 0 ' ' - - cov-fail-under = 7 5 '
2021-03-10 12:37:13 +01:00
'' ;
checkPhase = ''
runHook preCheck
$ { python . interpreter } - X utf8 test/run-tests.py
runHook postCheck
'' ;
pythonImportsCheck = [ " i p f s h t t p c l i e n t " ] ;
meta = with lib ; {
description = " A p y t h o n c l i e n t l i b r a r y f o r t h e I P F S A P I " ;
homepage = " h t t p s : / / g i t h u b . c o m / i p f s - s h i p y a r d / p y - i p f s - h t t p - c l i e n t " ;
license = licenses . mit ;
maintainers = with maintainers ; [ mguentner Luflosi ] ;
} ;
}