git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #26166 from risicle/django-compat-hijack-tests

python: django-compat & django-hijack tests (also bump django-hijack)

commit61ce84904e728c4d340a48b5a56405afec2fdbba authorLancelot SIX <lsix+github@lancelotsix.com> dateTue 30 May 2017, 09:29 (9 years ago) parentccafbacfa44b72
3 files changed+66−24
pkgs/development/python-modules/django-compat/default.nix+25−6 pkgs/development/python-modules/django-hijack/default.nix+39 pkgs/top-level/python-packages.nix+2−18
pkgs/development/python-modules/django-compat/default.nix+25−6
@@ -1,4 +1,4 @@
1−{ stdenv, buildPythonPackage, fetchurl,
1+{ stdenv, buildPythonPackage, fetchFromGitHub, python,
22 django, django_nose, six
33}:
44buildPythonPackage rec {
@@ -6,19 +6,38 @@ buildPythonPackage rec {
66 name = "${pname}-${version}";
77 version = "1.0.14";
88
9− src = fetchurl {
10− url = "mirror://pypi/d/django-compat/${name}.tar.gz";
11− sha256 = "18y5bxxmafcd4np42mzbalva5lpssq0b8ki7zckbzvdv2mnv43xj";
9+ # the pypi packages don't include everything required for the tests
10+ src = fetchFromGitHub {
11+ owner = "arteria";
12+ repo = "django-compat";
13+ rev = "v${version}";
14+ sha256 = "11g6ra6djkchqk44v8k7biaxd1v69qyyyask5l92vmrvb0qiwvm8";
1215 };
1316
14− doCheck = false;
17+ checkPhase = ''
18+ runHook preCheck
1519
16− buildInputs = [ django_nose ];
20+ # we have to do a little bit of tinkering to convince the tests to run against the installed package, not the
21+ # source directory
22+ mkdir -p testbase/compat
23+ pushd testbase
24+ # note we're not copying the direct contents of compat/ (notably __init__.py) so python won't recognize this as a
25+ # package, but the tests need to be in a specific path for the test templates to get picked up.
26+ cp -r ../compat/tests compat/
27+ cp ../runtests.py .
28+ ${python.interpreter} runtests.py compat/tests
29+ popd
30+
31+ runHook postCheck
32+ '';
33+
34+ checkInputs = [ django_nose ];
1735 propagatedBuildInputs = [ django six ];
1836
1937 meta = with stdenv.lib; {
2038 description = "Forward and backwards compatibility layer for Django 1.4, 1.7, 1.8, 1.9, 1.10 and 1.11";
2139 homepage = https://github.com/arteria/django-compat;
2240 license = licenses.mit;
41+ maintainers = with maintainers; [ ris ];
2342 };
2443}
pkgs/development/python-modules/django-hijack/default.nixnew file+39
@@ -0,0 +1,39 @@
1+{ stdenv, buildPythonPackage, fetchFromGitHub, python,
2+ django, django_compat, django_nose
3+}:
4+buildPythonPackage rec {
5+ name = "django-hijack-${version}";
6+ version = "2.1.4";
7+
8+ # the pypi packages don't include everything required for the tests
9+ src = fetchFromGitHub {
10+ owner = "arteria";
11+ repo = "django-hijack";
12+ rev = "v${version}";
13+ sha256 = "1wbm6l8mzpkj4wsj4fyfamzpzi3day2v1cva5j89v4dn4403jq21";
14+ };
15+
16+ checkInputs = [ django_nose ];
17+ propagatedBuildInputs = [ django django_compat ];
18+
19+ checkPhase = ''
20+ runHook preCheck
21+
22+ # we have to do a little bit of tinkering to convince the tests to run against the installed package, not the
23+ # source directory
24+ mkdir testbase
25+ pushd testbase
26+ cp ../runtests.py .
27+ ${python.interpreter} runtests.py hijack
28+ popd
29+
30+ runHook postCheck
31+ '';
32+
33+ meta = with stdenv.lib; {
34+ description = "Allows superusers to hijack (=login as) and work on behalf of another user";
35+ homepage = https://github.com/arteria/django-hijack;
36+ license = licenses.mit;
37+ maintainers = with maintainers; [ ris ];
38+ };
39+}
pkgs/top-level/python-packages.nix+2−18
@@ -10181,26 +10181,10 @@ in {
1018110181 };
1018210182 };
1018310183
10184− # This package likely needs an older version of Django.
10184+ # This package may need an older version of Django.
1018510185 # Override the package set and set e.g. `django = super.django_1_9`.
1018610186 # See the Nixpkgs manual for examples on how to override the package set.
10187− django_hijack = buildPythonPackage rec {
10188− name = "django-hijack-${version}";
10189− version = "2.0.7";
10190−
10191− src = pkgs.fetchurl {
10192− url = "mirror://pypi/d/django-hijack/${name}.tar.gz";
10193− sha256 = "0rpi1bkfx74xfbb2nk874kfdra1jcqp2vzky1r3z7zidlc9kah04";
10194− };
10195−
10196− propagatedBuildInputs = with self; [ django django_compat ];
10197−
10198− meta = {
10199− description = "Allows superusers to hijack (=login as) and work on behalf of another user";
10200− homepage = https://github.com/arteria/django-hijack;
10201− license = licenses.mit;
10202− };
10203− };
10187+ django_hijack = callPackage ../development/python-modules/django-hijack { };
1020410188
1020510189 django_nose = buildPythonPackage rec {
1020610190 name = "django-nose-${version}";