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