Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nplusone and pytest-pythonpath Python packages #94054

Merged
merged 2 commits into from
Aug 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 49 additions & 0 deletions pkgs/development/python-modules/nplusone/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{ blinker, buildPythonPackage, fetchFromGitHub, lib, isPy27, six, mock, pytest
, webtest, pytestcov, pytest-django, pytest-pythonpath, flake8, sqlalchemy
, flask_sqlalchemy, peewee }:

buildPythonPackage rec {
pname = "nplusone";
version = "1.0.0";
disabled = isPy27;

src = fetchFromGitHub {
owner = "jmcarp";
repo = "nplusone";
rev = "v${version}";
sha256 = "0qdwpvvg7dzmksz3vqkvb27n52lq5sa8i06m7idnj5xk2dgjkdxg";
};

# The tests assume the source code is in an nplusone/ directory. When using
# the Nix sandbox, it will be in a source/ directory instead, making the
# tests fail.
prePatch = ''
substituteInPlace tests/conftest.py \
--replace nplusone/tests/conftest source/tests/conftest
'';

checkPhase = ''
pytest tests/
'';

propagatedBuildInputs = [ six blinker ];
checkInputs = [
mock
pytest
webtest
pytestcov
pytest-django
pytest-pythonpath
flake8
sqlalchemy
flask_sqlalchemy
peewee
];

meta = with lib; {
description = "Detecting the n+1 queries problem in Python";
homepage = "https://github.com/jmcarp/nplusone";
maintainers = with maintainers; [ cript0nauta ];
license = licenses.mit;
};
}
26 changes: 26 additions & 0 deletions pkgs/development/python-modules/pytest-pythonpath/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{ buildPythonPackage, fetchPypi, lib, pytest }:

buildPythonPackage rec {
pname = "pytest-pythonpath";
version = "0.7.3";

src = fetchPypi {
inherit pname version;
sha256 = "0qhxh0z2b3p52v3i0za9mrmjnb1nlvvyi2g23rf88b3xrrm59z33";
};

propagatedBuildInputs = [ pytest ];
checkInputs = [ pytest ];

checkPhase = ''
pytest
'';

meta = with lib; {
description =
"Pytest plugin for adding to the PYTHONPATH from command line or configs";
homepage = "https://github.com/bigsassy/pytest-pythonpath";
maintainers = with maintainers; [ cript0nauta ];
license = licenses.mit;
};
}
4 changes: 4 additions & 0 deletions pkgs/top-level/python-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2514,6 +2514,8 @@ in {

mxnet = callPackage ../development/python-modules/mxnet { };

nplusone = callPackage ../development/python-modules/nplusone { };

parsy = callPackage ../development/python-modules/parsy { };

portalocker = callPackage ../development/python-modules/portalocker { };
Expand Down Expand Up @@ -2655,6 +2657,8 @@ in {

pytest-pep257 = callPackage ../development/python-modules/pytest-pep257 { };

pytest-pythonpath = callPackage ../development/python-modules/pytest-pythonpath { };

pytest-raisesregexp = callPackage ../development/python-modules/pytest-raisesregexp { };

pytest-random-order = callPackage ../development/python-modules/pytest-random-order { };
Expand Down