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