1{ lib 2, blinker 3, buildPythonPackage 4, fetchFromGitHub 5, flake8 6, flask_sqlalchemy 7, isPy27 8, mock 9, peewee 10, pytest-django 11, pytest-pythonpath 12, pytestCheckHook 13, six 14, sqlalchemy 15, webtest 16}: 17 18buildPythonPackage rec { 19 pname = "nplusone"; 20 version = "1.0.0"; 21 disabled = isPy27; 22 23 src = fetchFromGitHub { 24 owner = "jmcarp"; 25 repo = "nplusone"; 26 rev = "v${version}"; 27 sha256 = "0qdwpvvg7dzmksz3vqkvb27n52lq5sa8i06m7idnj5xk2dgjkdxg"; 28 }; 29 30 propagatedBuildInputs = [ 31 blinker 32 six 33 ]; 34 35 checkInputs = [ 36 flake8 37 flask_sqlalchemy 38 mock 39 peewee 40 pytest-django 41 pytest-pythonpath 42 pytestCheckHook 43 sqlalchemy 44 webtest 45 ]; 46 47 # The tests assume the source code is in an nplusone/ directory. When using 48 # the Nix sandbox, it will be in a source/ directory instead, making the 49 # tests fail. 50 prePatch = '' 51 substituteInPlace tests/conftest.py \ 52 --replace nplusone/tests/conftest source/tests/conftest 53 ''; 54 55 postPatch = '' 56 substituteInPlace pytest.ini \ 57 --replace "--cov nplusone --cov-report term-missing" "" 58 ''; 59 60 disabledTests = [ 61 # Tests are out-dated 62 "test_many_to_one" 63 "test_many_to_many" 64 "test_eager_join" 65 "test_eager_subquery" 66 "test_eager_subquery_unused" 67 "test_many_to_many_raise" 68 "test_many_to_many_whitelist_decoy" 69 "test_many_to_one_subquery" 70 "test_many_to_one_reverse_subquery" 71 "test_many_to_many_subquery" 72 "test_many_to_many_reverse_subquery" 73 "test_profile" 74 ]; 75 76 pythonImportsCheck = [ "nplusone" ]; 77 78 meta = with lib; { 79 description = "Detecting the n+1 queries problem in Python"; 80 homepage = "https://github.com/jmcarp/nplusone"; 81 maintainers = with maintainers; [ cript0nauta ]; 82 license = licenses.mit; 83 }; 84}