2022-06-16 17:23:12 +00:00
{ stdenv
, lib
2021-04-15 00:37:46 +00:00
, 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-07-14 22:03:04 +00:00
version = " 0 . 8 . 0 a 2 " ;
2021-04-15 00:37:46 +00:00
format = " f l i t " ;
2021-07-14 22:03:04 +00:00
disabled = pythonOlder " 3 . 6 " ;
2021-04-15 00:37:46 +00: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-07-14 22:03:04 +00: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-04-15 00:37:46 +00: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-07-14 22:03:04 +00:00
# This can be removed for the 0.8.0 release
2021-04-15 00:37:46 +00: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-19 01:06:50 +00: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")'
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-04-15 00:37:46 +00:00
'' ;
checkPhase = ''
runHook preCheck
$ { python . interpreter } - X utf8 test/run-tests.py
runHook postCheck
'' ;
2022-09-09 14:08:57 +00:00
doCheck = false ;
2021-04-15 00:37:46 +00:00
pythonImportsCheck = [ " i p f s h t t p c l i e n t " ] ;
meta = with lib ; {
2022-06-16 17:23:12 +00:00
broken = stdenv . isDarwin ;
2021-04-15 00:37:46 +00:00
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 ] ;
} ;
}