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