2021-02-17 17:02:09 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, pythonOlder
|
2024-01-13 08:15:51 +00:00
|
|
|
|
|
|
|
# build-system
|
|
|
|
, setuptools
|
|
|
|
|
|
|
|
# tests
|
|
|
|
, pytestCheckHook
|
2021-02-17 17:02:09 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pyfakefs";
|
2024-01-13 08:15:51 +00:00
|
|
|
version = "5.3.2";
|
|
|
|
pyproject = true;
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
disabled = pythonOlder "3.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-01-13 08:15:51 +00:00
|
|
|
hash = "sha256-qDd2o8EEbU0QPy9TACmqbN/18Dht/9WcFe4WkmE1STw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# test doesn't work in sandbox
|
|
|
|
substituteInPlace pyfakefs/tests/fake_filesystem_test.py \
|
|
|
|
--replace "test_expand_root" "notest_expand_root"
|
|
|
|
substituteInPlace pyfakefs/tests/fake_os_test.py \
|
|
|
|
--replace "test_path_links_not_resolved" "notest_path_links_not_resolved" \
|
|
|
|
--replace "test_append_mode_tell_linux_windows" "notest_append_mode_tell_linux_windows"
|
2021-02-05 17:12:51 +00:00
|
|
|
'' + (lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# this test fails on darwin due to case-insensitive file system
|
|
|
|
substituteInPlace pyfakefs/tests/fake_os_test.py \
|
|
|
|
--replace "test_rename_dir_to_existing_dir" "notest_rename_dir_to_existing_dir"
|
|
|
|
'');
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"pyfakefs"
|
|
|
|
];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
2023-11-16 04:20:00 +00:00
|
|
|
];
|
|
|
|
|
2024-01-13 08:15:51 +00:00
|
|
|
# https://github.com/jmcgeheeiv/pyfakefs/issues/581 (OSError: [Errno 9] Bad file descriptor)
|
|
|
|
#disabledTests = [ "test_open_existing_pipe" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Fake file system that mocks the Python file system modules";
|
2021-02-17 17:02:09 +00:00
|
|
|
homepage = "http://pyfakefs.org/";
|
2024-01-13 08:15:51 +00:00
|
|
|
changelog = "https://github.com/jmcgeheeiv/pyfakefs/blob/v${version}/CHANGES.md";
|
2021-02-17 17:02:09 +00:00
|
|
|
license = licenses.asl20;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ gebner ];
|
|
|
|
};
|
|
|
|
}
|