1{
2 lib,
3 buildPythonPackage,
4 callPackage,
5 fetchFromGitHub,
6 pythonOlder,
7 pytest,
8 setuptools-scm,
9 backports-asyncio-runner,
10}:
11
12buildPythonPackage rec {
13 pname = "pytest-asyncio";
14 version = "1.1.0"; # N.B.: when updating, tests bleak and aioesphomeapi tests
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "pytest-dev";
19 repo = "pytest-asyncio";
20 tag = "v${version}";
21 hash = "sha256-+dLOzMPKI3nawfyZVZZ6hg6OkaEGZBp8oC5VIr7y0es=";
22 };
23
24 outputs = [
25 "out"
26 "testout"
27 ];
28
29 build-system = [ setuptools-scm ];
30
31 buildInputs = [ pytest ];
32 dependencies = lib.optionals (pythonOlder "3.11") [
33 backports-asyncio-runner
34 ];
35
36 postInstall = ''
37 mkdir $testout
38 cp -R tests $testout/tests
39 '';
40
41 doCheck = false;
42 passthru.tests.pytest = callPackage ./tests.nix { };
43
44 pythonImportsCheck = [ "pytest_asyncio" ];
45
46 meta = with lib; {
47 description = "Library for testing asyncio code with pytest";
48 homepage = "https://github.com/pytest-dev/pytest-asyncio";
49 changelog = "https://github.com/pytest-dev/pytest-asyncio/blob/${src.tag}/docs/reference/changelog.rst";
50 license = licenses.asl20;
51 maintainers = with maintainers; [ dotlambda ];
52 };
53}