1{ stdenv, buildPythonPackage, fetchPypi, python, pytest, glibcLocales, isPy37 }:
2
3buildPythonPackage rec {
4 version = "3.7.1";
5 pname = "pyfakefs";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "1eb68bb250cc14310a6e33c197cbe2c8d93832b543f534e29b58286712f7e2b2";
10 };
11
12 postPatch = ''
13 # test doesn't work in sandbox
14 substituteInPlace pyfakefs/tests/fake_filesystem_test.py \
15 --replace "test_expand_root" "notest_expand_root"
16 substituteInPlace pyfakefs/tests/fake_os_test.py \
17 --replace "test_path_links_not_resolved" "notest_path_links_not_resolved" \
18 --replace "test_append_mode_tell_linux_windows" "notest_append_mode_tell_linux_windows"
19 substituteInPlace pyfakefs/tests/fake_filesystem_unittest_test.py \
20 --replace "test_copy_real_file" "notest_copy_real_file"
21 '' + (stdenv.lib.optionalString stdenv.isDarwin ''
22 # this test fails on darwin due to case-insensitive file system
23 substituteInPlace pyfakefs/tests/fake_os_test.py \
24 --replace "test_rename_dir_to_existing_dir" "notest_rename_dir_to_existing_dir"
25 '');
26
27 # https://github.com/jmcgeheeiv/pyfakefs/issues/508
28 doCheck = !isPy37;
29 checkInputs = [ pytest glibcLocales ];
30
31 checkPhase = ''
32 export LC_ALL=en_US.UTF-8
33 ${python.interpreter} -m pyfakefs.tests.all_tests
34 ${python.interpreter} -m pyfakefs.tests.all_tests_without_extra_packages
35 ${python.interpreter} -m pytest pyfakefs/pytest_tests/pytest_plugin_test.py
36 '';
37
38 meta = with stdenv.lib; {
39 description = "Fake file system that mocks the Python file system modules";
40 license = licenses.asl20;
41 homepage = http://pyfakefs.org/;
42 maintainers = with maintainers; [ gebner ];
43 };
44}