1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 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 src = fetchFromGitHub { 22 owner = "ClearcodeHQ"; 23 repo = "pytest-postgresql"; 24 tag = "v${version}"; 25 hash = "sha256-6D9QNcfq518ORQDYCH5G+LLJ7tVWPFwB6ylZR3LOZ5g="; 26 }; 27 28 postPatch = '' 29 substituteInPlace pyproject.toml \ 30 --replace-fail "--max-worker-restart=0" "" 31 sed -i 's#/usr/lib/postgresql/.*/bin/pg_ctl#${postgresql}/bin/pg_ctl#' pytest_postgresql/plugin.py 32 ''; 33 34 buildInputs = [ pytest ]; 35 36 dependencies = [ 37 mirakuru 38 port-for 39 psycopg 40 setuptools # requires 'pkg_resources' at runtime 41 ]; 42 43 nativeCheckInputs = [ 44 postgresql 45 pytestCheckHook 46 pytest-cov-stub 47 ]; 48 pytestFlags = [ 49 "-pno:postgresql" 50 ]; 51 disabledTestPaths = [ "tests/docker/test_noproc_docker.py" ]; # requires Docker 52 disabledTests = [ 53 # permissions issue running pg as Nixbld user 54 "test_executor_init_with_password" 55 # "ValueError: Pytest terminal summary report not found" 56 "test_postgres_loader_in_cli" 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 # Can't reliably run checkPhase on darwin because of nix bug, see: 66 # https://github.com/NixOS/nixpkgs/issues/371242 67 doCheck = !stdenv.buildPlatform.isDarwin; 68 69 meta = { 70 homepage = "https://pypi.python.org/pypi/pytest-postgresql"; 71 description = "Pytest plugin that enables you to test code on a temporary PostgreSQL database"; 72 changelog = "https://github.com/ClearcodeHQ/pytest-postgresql/blob/v${version}/CHANGES.rst"; 73 license = lib.licenses.lgpl3Plus; 74 maintainers = with lib.maintainers; [ bcdarwin ]; 75 }; 76}