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