1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 pytestCheckHook,
7 pytest-cov-stub,
8 setuptools,
9 mirakuru,
10 port-for,
11 psycopg,
12 pytest,
13 postgresql,
14}:
15
16buildPythonPackage rec {
17 pname = "pytest-postgresql";
18 version = "6.0.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "ClearcodeHQ";
25 repo = "pytest-postgresql";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-6D9QNcfq518ORQDYCH5G+LLJ7tVWPFwB6ylZR3LOZ5g=";
28 };
29
30 postPatch = ''
31 substituteInPlace pyproject.toml \
32 --replace-fail "--max-worker-restart=0" ""
33 sed -i 's#/usr/lib/postgresql/.*/bin/pg_ctl#${postgresql}/bin/pg_ctl#' pytest_postgresql/plugin.py
34 '';
35
36 buildInputs = [ pytest ];
37
38 propagatedBuildInputs = [
39 mirakuru
40 port-for
41 psycopg
42 setuptools # requires 'pkg_resources' at runtime
43 ];
44
45 nativeCheckInputs = [
46 postgresql
47 pytestCheckHook
48 pytest-cov-stub
49 ];
50 pytestFlagsArray = [
51 "-p"
52 "no:postgresql"
53 ];
54 disabledTestPaths = [ "tests/docker/test_noproc_docker.py" ]; # requires Docker
55 disabledTests = [
56 # permissions issue running pg as Nixbld user
57 "test_executor_init_with_password"
58 # "ValueError: Pytest terminal summary report not found"
59 "test_postgres_loader_in_cli"
60 "test_postgres_options_config_in_cli"
61 "test_postgres_options_config_in_ini"
62 ];
63 pythonImportsCheck = [
64 "pytest_postgresql"
65 "pytest_postgresql.executor"
66 ];
67
68 meta = with lib; {
69 homepage = "https://pypi.python.org/pypi/pytest-postgresql";
70 description = "Pytest plugin that enables you to test code on a temporary PostgreSQL database";
71 changelog = "https://github.com/ClearcodeHQ/pytest-postgresql/blob/v${version}/CHANGES.rst";
72 license = licenses.lgpl3Plus;
73 maintainers = with maintainers; [ bcdarwin ];
74 };
75}