diff --git a/pkgs/development/python-modules/pydub/default.nix b/pkgs/development/python-modules/pydub/default.nix index 28a76da4bd96..0770c78b674b 100644 --- a/pkgs/development/python-modules/pydub/default.nix +++ b/pkgs/development/python-modules/pydub/default.nix @@ -1,19 +1,29 @@ -{ stdenv, buildPythonPackage, fetchPypi, scipy, ffmpeg-full }: +{ stdenv, buildPythonPackage, fetchFromGitHub, scipy, ffmpeg-full }: buildPythonPackage rec { pname = "pydub"; version = "0.22.1"; - src = fetchPypi { - inherit pname version; - sha256 = "20beff39e9959a3b2cb4392802aecb9b2417837fff635d2b00b5ef5f5326d313"; + # pypi version doesn't include required data files for tests + src = fetchFromGitHub { + owner = "jiaaro"; + repo = pname; + rev = "v${version}"; + sha256 = "0xqyvzgdfy01p98wnvsrf6iwdfq91ad377r6j12r8svm13ygx5bv"; }; - patches = [ - ./pyaudioop-python3.patch - ]; + + # disable a test that fails on aarch64 due to rounding errors + postPatch = stdenv.lib.optionalString stdenv.isAarch64 '' + substituteInPlace test/test.py \ + --replace "test_overlay_with_gain_change" "notest_overlay_with_gain_change" + ''; checkInputs = [ scipy ffmpeg-full ]; + checkPhase = '' + python test/test.py + ''; + meta = with stdenv.lib; { description = "Manipulate audio with a simple and easy high level interface."; homepage = "http://pydub.com/"; diff --git a/pkgs/development/python-modules/pydub/pyaudioop-python3.patch b/pkgs/development/python-modules/pydub/pyaudioop-python3.patch deleted file mode 100644 index 58c56db5b8a5..000000000000 --- a/pkgs/development/python-modules/pydub/pyaudioop-python3.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git i/pydub/pyaudioop.py w/pydub/pyaudioop.py -index 8f8f017..aa6bb8c 100644 ---- i/pydub/pyaudioop.py -+++ w/pydub/pyaudioop.py -@@ -1,4 +1,4 @@ --import __builtin__ -+import builtins - import math - import struct - from fractions import gcd -@@ -79,7 +79,7 @@ def _get_minval(size, signed=True): - def _get_clipfn(size, signed=True): - maxval = _get_maxval(size, signed) - minval = _get_minval(size, signed) -- return lambda val: __builtin__.max(min(val, maxval), minval) -+ return lambda val: builtins.max(min(val, maxval), minval) - - - def _overflow(val, size, signed=True): -@@ -109,7 +109,7 @@ def max(cp, size): - if len(cp) == 0: - return 0 - -- return __builtin__.max(abs(sample) for sample in _get_samples(cp, size)) -+ return builtins.max(abs(sample) for sample in _get_samples(cp, size)) - - - def minmax(cp, size): -@@ -117,8 +117,8 @@ def minmax(cp, size): - - max_sample, min_sample = 0, 0 - for sample in _get_samples(cp, size): -- max_sample = __builtin__.max(sample, max_sample) -- min_sample = __builtin__.min(sample, min_sample) -+ max_sample = builtins.max(sample, max_sample) -+ min_sample = builtins.min(sample, min_sample) - - return min_sample, max_sample - -@@ -542,4 +542,4 @@ def lin2adpcm(cp, size, state): - - - def adpcm2lin(cp, size, state): -- raise NotImplementedError() -\ No newline at end of file -+ raise NotImplementedError() diff --git a/pkgs/development/python-modules/pyfakefs/default.nix b/pkgs/development/python-modules/pyfakefs/default.nix index cfb575c7675e..64d547ce97ed 100644 --- a/pkgs/development/python-modules/pyfakefs/default.nix +++ b/pkgs/development/python-modules/pyfakefs/default.nix @@ -1,7 +1,7 @@ { stdenv, buildPythonPackage, fetchFromGitHub, python, pytest, glibcLocales }: buildPythonPackage rec { - version = "3.4.1"; + version = "3.4.3"; pname = "pyfakefs"; # no tests in PyPI tarball @@ -10,22 +10,30 @@ buildPythonPackage rec { owner = "jmcgeheeiv"; repo = pname; rev = "v${version}"; - sha256 = "0i8kq7sl8bczr927hllgfhsmirjqjh89c9184kcqmprc13ac4kxy"; + sha256 = "0rhbkcb5h2x8kmyxivr5jr1db2xvmpjdbsfjxl142qhfb29hr2hp"; }; postPatch = '' # test doesn't work in sandbox - substituteInPlace tests/fake_filesystem_test.py \ + substituteInPlace pyfakefs/tests/fake_filesystem_test.py \ --replace "test_expand_root" "notest_expand_root" - substituteInPlace tests/fake_os_test.py \ - --replace "test_append_mode" "notest_append_mode" - ''; + substituteInPlace pyfakefs/tests/fake_os_test.py \ + --replace "test_path_links_not_resolved" "notest_path_links_not_resolved" \ + --replace "test_append_mode_tell_linux_windows" "notest_append_mode_tell_linux_windows" + substituteInPlace pyfakefs/tests/fake_filesystem_unittest_test.py \ + --replace "test_copy_real_file" "notest_copy_real_file" + '' + (stdenv.lib.optionalString stdenv.isDarwin '' + # this test fails on darwin due to case-insensitive file system + substituteInPlace pyfakefs/tests/fake_os_test.py \ + --replace "test_rename_dir_to_existing_dir" "notest_rename_dir_to_existing_dir" + ''); checkInputs = [ pytest glibcLocales ]; checkPhase = '' - LC_ALL=en_US.UTF-8 ${python.interpreter} -m tests.all_tests - py.test tests/pytest_plugin_test.py + export LC_ALL=en_US.UTF-8 + ${python.interpreter} -m pyfakefs.tests.all_tests + ${python.interpreter} -m pytest pyfakefs/tests/pytest_plugin_test.py ''; meta = with stdenv.lib; { diff --git a/pkgs/development/python-modules/readme_renderer/default.nix b/pkgs/development/python-modules/readme_renderer/default.nix index 4690dcc89bc8..d6c333ce36de 100644 --- a/pkgs/development/python-modules/readme_renderer/default.nix +++ b/pkgs/development/python-modules/readme_renderer/default.nix @@ -27,7 +27,8 @@ buildPythonPackage rec { ]; checkPhase = '' - py.test + # disable one failing test case + py.test -k "not test_invalid_link" ''; meta = { diff --git a/pkgs/development/python-modules/restview/default.nix b/pkgs/development/python-modules/restview/default.nix index e8a8b9dd637d..a6b22220da35 100644 --- a/pkgs/development/python-modules/restview/default.nix +++ b/pkgs/development/python-modules/restview/default.nix @@ -1,6 +1,7 @@ { lib , buildPythonPackage , fetchPypi +, fetchpatch , docutils , readme_renderer , pygments @@ -19,6 +20,15 @@ buildPythonPackage rec { propagatedBuildInputs = [ docutils readme_renderer pygments ]; checkInputs = [ mock ]; + patches = [ + # fix tests after readme_renderer update + # TODO remove on next update + (fetchpatch { + url = "https://github.com/mgedmin/restview/commit/541743ded13ae55dea4c437046984a5f13d06e8b.patch"; + sha256 = "031b1dlqx346bz7afpc011lslnq771lnxb6iy1l2285pph534bci"; + }) + ]; + postPatch = '' # dict order breaking tests sed -i 's@@...@' src/restview/tests.py diff --git a/pkgs/development/python-modules/us/default.nix b/pkgs/development/python-modules/us/default.nix index eb001410ce5f..53b5bc9ad166 100644 --- a/pkgs/development/python-modules/us/default.nix +++ b/pkgs/development/python-modules/us/default.nix @@ -15,6 +15,13 @@ buildPythonPackage rec { sha256 = "1niglalkp7pinibzbxjdz9mxx9qmwkrh8884dag3kr72cfkrpp09"; }; + # Upstream requires jellyfish==0.5.6 but we have 0.6.1 + postPatch = '' + substituteInPlace setup.py --replace "jellyfish==" "jellyfish>=" + ''; + + doCheck = false; # pypi version doesn't include tests + meta = { description = "A package for easily working with US and state metadata"; longDescription = ''