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