summary refs log tree commit diff
path: root/pkgs/development/python-modules/django-compat
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2017-05-28 01:07:47 +0100
committerRobert Scott <code@humanleg.org.uk>2017-05-28 14:43:34 +0100
commitac8a58b5b44859f805e9613ec6cd55c3904ecbc0 (patch)
treea2aa627054a094c4c6ee68079f4aeca1a5674f3a /pkgs/development/python-modules/django-compat
parenta50315d7365ebb54fb59c2e409ae49ae608012bd (diff)
downloadnixlib-ac8a58b5b44859f805e9613ec6cd55c3904ecbc0.tar
nixlib-ac8a58b5b44859f805e9613ec6cd55c3904ecbc0.tar.gz
nixlib-ac8a58b5b44859f805e9613ec6cd55c3904ecbc0.tar.bz2
nixlib-ac8a58b5b44859f805e9613ec6cd55c3904ecbc0.tar.lz
nixlib-ac8a58b5b44859f805e9613ec6cd55c3904ecbc0.tar.xz
nixlib-ac8a58b5b44859f805e9613ec6cd55c3904ecbc0.tar.zst
nixlib-ac8a58b5b44859f805e9613ec6cd55c3904ecbc0.zip
python.pkgs.django_compat: get tests working & enable them
also add self as maintainer
Diffstat (limited to 'pkgs/development/python-modules/django-compat')
-rw-r--r--pkgs/development/python-modules/django-compat/default.nix31
1 files changed, 25 insertions, 6 deletions
diff --git a/pkgs/development/python-modules/django-compat/default.nix b/pkgs/development/python-modules/django-compat/default.nix
index 22f78533142e..591031912854 100644
--- a/pkgs/development/python-modules/django-compat/default.nix
+++ b/pkgs/development/python-modules/django-compat/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonPackage, fetchurl,
+{ stdenv, buildPythonPackage, fetchFromGitHub, python,
   django, django_nose, six
 }:
 buildPythonPackage rec {
@@ -6,19 +6,38 @@ buildPythonPackage rec {
   name = "${pname}-${version}";
   version = "1.0.14";
 
-  src = fetchurl {
-    url = "mirror://pypi/d/django-compat/${name}.tar.gz";
-    sha256 = "18y5bxxmafcd4np42mzbalva5lpssq0b8ki7zckbzvdv2mnv43xj";
+  # the pypi packages don't include everything required for the tests
+  src = fetchFromGitHub {
+    owner = "arteria";
+    repo = "django-compat";
+    rev = "v${version}";
+    sha256 = "11g6ra6djkchqk44v8k7biaxd1v69qyyyask5l92vmrvb0qiwvm8";
   };
 
-  doCheck = false;
+  checkPhase = ''
+    runHook preCheck
 
-  buildInputs = [ django_nose ];
+    # we have to do a little bit of tinkering to convince the tests to run against the installed package, not the
+    # source directory
+    mkdir -p testbase/compat
+    pushd testbase
+    # note we're not copying the direct contents of compat/ (notably __init__.py) so python won't recognize this as a
+    # package, but the tests need to be in a specific path for the test templates to get picked up.
+    cp -r ../compat/tests compat/
+    cp ../runtests.py .
+    ${python.interpreter} runtests.py compat/tests
+    popd
+
+    runHook postCheck
+  '';
+
+  checkInputs = [ django_nose ];
   propagatedBuildInputs = [ django six ];
 
   meta = with stdenv.lib; {
     description = "Forward and backwards compatibility layer for Django 1.4, 1.7, 1.8, 1.9, 1.10 and 1.11";
     homepage = https://github.com/arteria/django-compat;
     license = licenses.mit;
+    maintainers = with maintainers; [ ris ];
   };
 }