about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pytest-postgresql/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pytest-postgresql/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pytest-postgresql/default.nix73
1 files changed, 73 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pytest-postgresql/default.nix b/nixpkgs/pkgs/development/python-modules/pytest-postgresql/default.nix
new file mode 100644
index 000000000000..6eed5ef6ad2c
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pytest-postgresql/default.nix
@@ -0,0 +1,73 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, pythonOlder
+, pytestCheckHook
+, setuptools
+, mirakuru
+, port-for
+, psycopg
+, pytest
+, postgresql
+}:
+
+buildPythonPackage rec {
+  pname = "pytest-postgresql";
+  version = "5.0.0";
+  format = "pyproject";
+
+  disabled = pythonOlder "3.8";
+
+  src = fetchFromGitHub {
+    owner = "ClearcodeHQ";
+    repo = "pytest-postgresql";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-uWKp9yxTdlswoDPMlhx+2mF1cdhFzhGYKGHdXPGlz+w=";
+  };
+
+  postPatch = ''
+    substituteInPlace pyproject.toml  \
+      --replace "--cov" ""  \
+      --replace "--max-worker-restart=0" ""
+    sed -i 's#/usr/lib/postgresql/.*/bin/pg_ctl#${postgresql}/bin/pg_ctl#' pytest_postgresql/plugin.py
+  '';
+
+  buildInputs = [ pytest ];
+
+  propagatedBuildInputs = [
+    mirakuru
+    port-for
+    psycopg
+    setuptools  # requires 'pkg_resources' at runtime
+  ];
+
+  nativeCheckInputs = [
+    postgresql
+    pytestCheckHook
+  ];
+  pytestFlagsArray = [
+    "-p"
+    "no:postgresql"
+  ];
+  disabledTestPaths = [ "tests/docker/test_noproc_docker.py" ];  # requires Docker
+  disabledTests = [
+    # permissions issue running pg as Nixbld user
+    "test_executor_init_with_password"
+    # "ValueError: Pytest terminal summary report not found"
+    "test_postgres_options_config_in_cli"
+    "test_postgres_options_config_in_ini"
+  ];
+  pythonImportsCheck = [
+    "pytest_postgresql"
+    "pytest_postgresql.executor"
+  ];
+
+
+  meta = with lib; {
+    homepage = "https://pypi.python.org/pypi/pytest-postgresql";
+    description = "Pytest plugin that enables you to test code on a temporary PostgreSQL database";
+    changelog = "https://github.com/ClearcodeHQ/pytest-postgresql/blob/v${version}/CHANGES.rst";
+    license = licenses.lgpl3Plus;
+    maintainers = with maintainers; [ bcdarwin ];
+  };
+}