2017-05-14 19:05:50 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
python/natsort: Skip some tests with Python 3.[56]
Since the update to Python 3.6.3 in f906d6d18e87f4e2ee8a47d4f6040c77fd6
some of the Hypothesis tests in natsort suddenly begin to fail with
errors like this one:
res = '\x00\x00', f = <built-in function strxfrm>
> return partial(reduce, lambda res, f: f(res), functions)
E ValueError: embedded null character
The tests didn't fail with Python 3.6.2, but they did fail with Python
3.5 already.
I didn't dig through what the exact problem was, but I'd guess that the
problem could lie in Hypothesis itself. Unfortunately updating to the
latest version of Hypothesis didn't turn out to be that easy as well,
because the newer versions have a circular dependency on pytest and a
few other libraries.
So I opted against updating Hypothesis for now and just mark the tests
as "expected to fail" on purpose so that whenever we someday have a
newer version of Hypothesis, the build for natsort will fail and we can
remove this patch again.
Tested against Python 2.7, 3.4, 3.5 and 3.6 and all of the builds now
succeed.
Signed-off-by: aszlig <aszlig@nix.build>
Cc: @jluttine, @FRidh
2017-11-09 05:42:01 +00:00
|
|
|
, isPy35
|
|
|
|
, isPy36
|
2017-05-14 19:05:50 +01:00
|
|
|
, fetchPypi
|
|
|
|
, hypothesis
|
|
|
|
, pytestcache
|
|
|
|
, pytestcov
|
|
|
|
, pytestflakes
|
|
|
|
, pytestpep8
|
|
|
|
, pytest
|
|
|
|
, glibcLocales
|
|
|
|
, mock ? null
|
|
|
|
, pathlib ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
name = "${pname}-${version}";
|
|
|
|
pname = "natsort";
|
2017-11-24 19:36:20 +00:00
|
|
|
version = "5.1.1";
|
2017-05-14 19:05:50 +01:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
hypothesis
|
|
|
|
pytestcache
|
|
|
|
pytestcov
|
|
|
|
pytestflakes
|
|
|
|
pytestpep8
|
|
|
|
pytest
|
|
|
|
glibcLocales
|
|
|
|
]
|
|
|
|
# pathlib was made part of standard library in 3.5:
|
|
|
|
++ (lib.optionals (pythonOlder "3.4") [ pathlib ])
|
|
|
|
# based on testing-requirements.txt:
|
|
|
|
++ (lib.optionals (pythonOlder "3.3") [ mock ]);
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2017-11-24 19:36:20 +00:00
|
|
|
sha256 = "9ffbfb74bf3fc3905be1b9b052ed865675651e38fcd972ed1ed5c64a02f93cbd";
|
2017-05-14 19:05:50 +01:00
|
|
|
};
|
|
|
|
|
2018-01-20 12:31:14 +00:00
|
|
|
patches = lib.optional (isPy35 || isPy36) ./python-3.6.3-test-failures.patch;
|
2017-05-14 19:05:50 +01:00
|
|
|
|
|
|
|
# testing based on project's tox.ini
|
|
|
|
checkPhase = ''
|
|
|
|
pytest --doctest-modules natsort
|
|
|
|
pytest --flakes --pep8 --cov natsort --cov-report term-missing
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Natural sorting for python";
|
|
|
|
homepage = https://github.com/SethMMorton/natsort;
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
};
|
|
|
|
}
|