1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 poetry-core,
7 pytestCheckHook,
8}:
9
10buildPythonPackage rec {
11 pname = "sh";
12 version = "2.0.6";
13 format = "pyproject";
14
15 src = fetchFromGitHub {
16 owner = "amoffat";
17 repo = "sh";
18 rev = "refs/tags/${version}";
19 hash = "sha256-c4Ms4ydcW7LgmAI1WuYD74nzILuY/Xg+JePJe0q5AQQ=";
20 };
21
22 nativeBuildInputs = [ poetry-core ];
23
24 nativeCheckInputs = [ pytestCheckHook ];
25
26 pytestFlagsArray = [ "tests" ];
27
28 # A test needs the HOME directory to be different from $TMPDIR.
29 preCheck = ''
30 export HOME=$(mktemp -d)
31 '';
32
33 disabledTests =
34 [
35 # Disable tests that fail on Hydra
36 "test_no_fd_leak"
37 "test_piped_exception1"
38 "test_piped_exception2"
39 "test_unicode_path"
40 # fails to import itself after modifying the environment
41 "test_environment"
42 # timing sensitive through usage of sleep(1) and signal handling
43 # https://github.com/amoffat/sh/issues/684
44 "test_general_signal"
45 ]
46 ++ lib.optionals stdenv.isDarwin [
47 # Disable tests that fail on Darwin sandbox
48 "test_background_exception"
49 "test_cwd"
50 "test_ok_code"
51 ];
52
53 meta = with lib; {
54 description = "Python subprocess interface";
55 homepage = "https://pypi.python.org/pypi/sh/";
56 license = licenses.mit;
57 maintainers = with maintainers; [ siriobalmelli ];
58 };
59}