nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 pytestCheckHook,
7 pytest-cov-stub,
8 setuptools,
9 mirakuru,
10 packaging,
11 port-for,
12 psycopg,
13 pytest,
14 postgresql,
15}:
16
17buildPythonPackage rec {
18 pname = "pytest-postgresql";
19 version = "7.0.2";
20 pyproject = true;
21
22 src = fetchFromGitHub {
23 owner = "dbfixtures";
24 repo = "pytest-postgresql";
25 tag = "v${version}";
26 hash = "sha256-/EekUveW3wb8NlcKacMJpjjU7bpFvnNMpAuZ9h0sbpw=";
27 };
28
29 postPatch = ''
30 sed -i 's#/usr/lib/postgresql/.*/bin/pg_ctl#${postgresql}/bin/pg_ctl#' pytest_postgresql/plugin.py
31 '';
32
33 build-system = [ setuptools ];
34
35 buildInputs = [ pytest ];
36
37 dependencies = [
38 mirakuru
39 port-for
40 psycopg
41 packaging
42 ];
43
44 nativeCheckInputs = [
45 postgresql
46 pytestCheckHook
47 pytest-cov-stub
48 ];
49 pytestFlags = [
50 "-pno:postgresql"
51 ];
52 disabledTestPaths = [ "tests/docker/test_noproc_docker.py" ]; # requires Docker
53 disabledTests = [
54 # "ValueError: Pytest terminal summary report not found"
55 "test_postgres_drop_test_database"
56 "test_postgres_loader_in_cli"
57 "test_postgres_loader_in_ini"
58 "test_postgres_options_config_in_cli"
59 "test_postgres_options_config_in_ini"
60 "test_postgres_port_search_count_in_cli_is_int"
61 "test_postgres_port_search_count_in_ini_is_int"
62 ];
63 pythonImportsCheck = [
64 "pytest_postgresql"
65 "pytest_postgresql.executor"
66 ];
67
68 # Can't reliably run checkPhase on darwin because of nix bug, see:
69 # https://github.com/NixOS/nixpkgs/issues/371242
70 doCheck = !stdenv.buildPlatform.isDarwin;
71
72 meta = {
73 homepage = "https://pypi.python.org/pypi/pytest-postgresql";
74 description = "Pytest plugin that enables you to test code on a temporary PostgreSQL database";
75 changelog = "https://github.com/dbfixtures/pytest-postgresql/blob/v${version}/CHANGES.rst";
76 license = lib.licenses.lgpl3Plus;
77 maintainers = with lib.maintainers; [ bcdarwin ];
78 };
79}