1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch2,
6 buildPythonPackage,
7 python,
8 pythonOlder,
9 pytestCheckHook,
10 assertpy,
11 mock,
12 path,
13 pyhamcrest,
14 pytest-html,
15 colorama,
16 cucumber-tag-expressions,
17 parse,
18 parse-type,
19 setuptools,
20 six,
21}:
22
23buildPythonPackage rec {
24 pname = "behave";
25 version = "1.2.7.dev5";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "behave";
30 repo = "behave";
31 rev = "v${version}";
32 hash = "sha256-G1o0a57MRczwjGLl/tEYC+yx3nxpk6+E58RvR9kVJpA=";
33 };
34
35 patches = [
36 # fix tests: https://github.com/behave/behave/pull/1214
37 (fetchpatch2 {
38 url = "https://github.com/behave/behave/pull/1214/commits/98b63a2524eff50ce1dc7360a46462a6f673c5ea.patch?full_index=1";
39 hash = "sha256-MwODEm6vhg/H8ksp5XBBP5Uhu2dhB5B1T6Owkxpy3v0=";
40 })
41 ];
42
43 build-system = [ setuptools ];
44
45 nativeCheckInputs = [
46 pytestCheckHook
47 assertpy
48 mock
49 path
50 pyhamcrest
51 pytest-html
52 ];
53
54 doCheck = pythonOlder "3.12";
55
56 pythonImportsCheck = [ "behave" ];
57
58 dependencies = [
59 colorama
60 cucumber-tag-expressions
61 parse
62 parse-type
63 six
64 ];
65
66 postPatch = ''
67 patchShebangs bin
68 '';
69
70 # timing-based test flaky on Darwin
71 # https://github.com/NixOS/nixpkgs/pull/97737#issuecomment-691489824
72 disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
73 "test_step_decorator_async_run_until_complete"
74 ];
75
76 postCheck = ''
77 ${python.interpreter} bin/behave -f progress3 --stop --tags='~@xfail' features/
78 ${python.interpreter} bin/behave -f progress3 --stop --tags='~@xfail' tools/test-features/
79 ${python.interpreter} bin/behave -f progress3 --stop --tags='~@xfail' issue.features/
80 '';
81
82 meta = with lib; {
83 changelog = "https://github.com/behave/behave/blob/${src.rev}/CHANGES.rst";
84 homepage = "https://github.com/behave/behave";
85 description = "Behaviour-driven development, Python style";
86 mainProgram = "behave";
87 license = licenses.bsd2;
88 maintainers = with maintainers; [
89 alunduil
90 maxxk
91 ];
92 };
93}