python3Packages.priority: fix build, refactor package

This commit is contained in:
Martin Weinelt 2021-09-20 03:53:58 +02:00
parent f19e1cf5d9
commit f4db405910
2 changed files with 17 additions and 49 deletions

View file

@ -1,39 +0,0 @@
From 9d933c3c6535c1c63291e3d35f4ada9135d422df Mon Sep 17 00:00:00 2001
From: Alyssa Ross <hi@alyssa.is>
Date: Mon, 11 Mar 2019 02:08:43 +0000
Subject: [PATCH] Allow test_period_of_repetition to be slow
Recent versions of hypothesis default to a 200ms timeout, which wasn't
enough for my Thinkpad X220 to run this test. I've increased the timeout
for this single test to hopefully a reasonable amount for older
hardware.
(cherry picked from commit 752beb3a32b59f54168816da531c9d2a387f9715)
---
test/test_priority.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/test/test_priority.py b/test/test_priority.py
index c98a28d..013ce30 100644
--- a/test/test_priority.py
+++ b/test/test_priority.py
@@ -12,7 +12,7 @@ import itertools
import pytest
-from hypothesis import given
+from hypothesis import given, settings
from hypothesis.strategies import (
integers, lists, tuples, sampled_from
)
@@ -489,6 +489,7 @@ class TestPriorityTreeOutput(object):
fairness and equidistribution.
"""
@given(STREAMS_AND_WEIGHTS)
+ @settings(deadline=None)
def test_period_of_repetition(self, streams_and_weights):
"""
The period of repetition of a priority sequence is given by the sum of
--
2.19.2

View file

@ -1,28 +1,35 @@
{ lib, buildPythonPackage, fetchPypi, pytest, hypothesis }:
{ lib
, buildPythonPackage
, pythonOlder
, fetchPypi
, hypothesis
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "priority";
version = "2.0.0";
format = "setuptools";
disabled = pythonOlder "3.6.1";
src = fetchPypi {
inherit pname version;
sha256 = "c965d54f1b8d0d0b19479db3924c7c36cf672dbf2aec92d43fbdaf4492ba18c0";
};
patches = [
# https://github.com/python-hyper/priority/pull/135
./deadline.patch
pythonImportsCheck = [
"priority"
];
checkInputs = [ pytest hypothesis ];
checkPhase = ''
PYTHONPATH="src:$PYTHONPATH" pytest
'';
checkInputs = [
hypothesis
pytestCheckHook
];
meta = with lib; {
homepage = "https://python-hyper.org/priority/";
description = "A pure-Python implementation of the HTTP/2 priority tree";
homepage = "https://github.com/python-hyper/priority/";
license = licenses.mit;
maintainers = [ maintainers.qyliss ];
maintainers = with maintainers; [ qyliss ];
};
}