1{ stdenv, buildPythonPackage, fetchPypi, python, pytest, glibcLocales }:
2
3buildPythonPackage rec {
4 version = "3.5.7";
5 pname = "pyfakefs";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "8969435f8e7ca10f60c22096b02b15ad3af143de7d3bb4d73507b812bcdd8e37";
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 checkInputs = [ pytest glibcLocales ];
28
29 checkPhase = ''
30 export LC_ALL=en_US.UTF-8
31 ${python.interpreter} -m pyfakefs.tests.all_tests
32 ${python.interpreter} -m pyfakefs.tests.all_tests_without_extra_packages
33 ${python.interpreter} -m pytest pyfakefs/tests/pytest/pytest_plugin_test.py
34 '';
35
36 meta = with stdenv.lib; {
37 description = "Fake file system that mocks the Python file system modules";
38 license = licenses.asl20;
39 homepage = http://pyfakefs.org/;
40 maintainers = with maintainers; [ gebner ];
41 };
42}