Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / testing-postgresql / default.nix
blobad64fa53bebb53db89acfa563d152933f3f68c15
1 { lib
2 , buildPythonPackage
3 , fetchFromGitHub
4 , pg8000
5 , postgresql
6 , psycopg2
7 , pytestCheckHook
8 , pythonOlder
9 , sqlalchemy
10 , testing-common-database
13 buildPythonPackage rec {
14   pname = "testing-postgresql";
15   # Version 1.3.0 isn't working so let's use the latest commit from GitHub
16   version = "unstable-2017-10-31";
17   format = "setuptools";
19   disabled = pythonOlder "3.7";
21   src = fetchFromGitHub {
22     owner = "tk0miya";
23     repo = "testing.postgresql";
24     rev = "c81ded434d00ec8424de0f9e1f4063c778c6aaa8";
25     hash = "sha256-A4tahAaa98X66ZYa3QxIQDZkwAwVB6ZDRObEhkbUWKs=";
26   };
28   propagatedBuildInputs = [
29     testing-common-database
30     pg8000
31   ];
33   nativeCheckInputs = [
34     pytestCheckHook
35     psycopg2
36     sqlalchemy
37   ];
39   # Add PostgreSQL to search path
40   prePatch = ''
41     substituteInPlace src/testing/postgresql.py \
42       --replace "/usr/local/pgsql" "${postgresql}"
43   '';
45   postPatch = ''
46     substituteInPlace setup.py \
47       --replace "pg8000 >= 1.10" "pg8000"
48   '';
50   pythonImportsCheck = [
51     "testing.postgresql"
52   ];
54   # Fix tests for Darwin build. See:
55   # https://github.com/NixOS/nixpkgs/pull/74716#issuecomment-598546916
56   __darwinAllowLocalNetworking = true;
58   meta = with lib; {
59     description = "Use temporary postgresql instance in testing";
60     homepage = "https://github.com/tk0miya/testing.postgresql";
61     license = licenses.asl20;
62     platforms = platforms.linux;
63     maintainers = with maintainers; [ jluttine ];
64   };