1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 pythonOlder,
7
8 # build-system
9 setuptools,
10
11 # tests
12 pandas,
13 pytestCheckHook,
14 undefined,
15}:
16
17buildPythonPackage rec {
18 pname = "pyfakefs";
19 version = "5.5.0";
20 pyproject = true;
21
22 disabled = pythonOlder "3.5";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-dEiqoHFC+JLQpOtSpe0yBqnwLGWZ5obNl9YkwYl5wVQ=";
27 };
28
29 postPatch =
30 ''
31 # test doesn't work in sandbox
32 substituteInPlace pyfakefs/tests/fake_filesystem_test.py \
33 --replace "test_expand_root" "notest_expand_root"
34 substituteInPlace pyfakefs/tests/fake_os_test.py \
35 --replace "test_path_links_not_resolved" "notest_path_links_not_resolved" \
36 --replace "test_append_mode_tell_linux_windows" "notest_append_mode_tell_linux_windows"
37 ''
38 + (lib.optionalString stdenv.isDarwin ''
39 # this test fails on darwin due to case-insensitive file system
40 substituteInPlace pyfakefs/tests/fake_os_test.py \
41 --replace "test_rename_dir_to_existing_dir" "notest_rename_dir_to_existing_dir"
42 '');
43
44 nativeBuildInputs = [ setuptools ];
45
46 pythonImportsCheck = [ "pyfakefs" ];
47
48 nativeCheckInputs = [
49 pandas
50 pytestCheckHook
51 undefined
52 ];
53
54 meta = with lib; {
55 description = "Fake file system that mocks the Python file system modules";
56 homepage = "http://pyfakefs.org/";
57 changelog = "https://github.com/jmcgeheeiv/pyfakefs/blob/v${version}/CHANGES.md";
58 license = licenses.asl20;
59 maintainers = with maintainers; [ gebner ];
60 };
61}