From aa39e0fd24f1148d22893581e396caf47180d1c2 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 5 Oct 2017 21:58:07 +0100 Subject: gnu: django: Fix the build for python-django-gravatar2. The build was failing as the Django settings were not configured for the tests. The relevant files are missing from the release on PyPI, so switch to using a more complete source release. Also update the package at the same time. * gnu/packages/django.scm (python-django-gravatar2)[version]: 1.4.0 -> 1.4.2. [source]: Change to use a tarball from GitHub, update the sha256 hash. [arguments]: Add a phase to skip a test requiring network access, and replace the check phase to call ./manage.py within the example_project directory. --- gnu/packages/django.scm | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm index a901af6f14..f098ca707c 100644 --- a/gnu/packages/django.scm +++ b/gnu/packages/django.scm @@ -271,14 +271,39 @@ account authentication.") (source (origin (method url-fetch) - (uri (pypi-uri "django-gravatar2" version)) + (uri (string-append + "https://github.com/twaddington/django-gravatar/archive/" + version ".tar.gz")) (sha256 (base32 - "1qsv40xywbqsf4mkrmsswrpzqd7nfljxpfiim9an2z3dykn5rka6")))) + "1qa0awqkfnfcjx7d5ijgr9hj8ifpq5xrj16196im4hw9r9i1wapf")))) (build-system python-build-system) (arguments - '(;; TODO: The django project for the tests is missing from the release. - #:tests? #f)) + '(#:phases + (modify-phases %standard-phases + ;; TODO: Tagging the tests requiring the web could be done upstream. + (add-before 'check 'skip-test-requiring-network-access + (lambda _ + (substitute* "django_gravatar/tests.py" + (("def test_has_gravatar") + "from django.test import tag + @tag('requires-web') + def test_has_gravatar")))) + (replace 'check + (lambda _ + (setenv "PYTHONPATH" + (string-append + (getcwd) + ":" + (getenv "PYTHONPATH"))) + (with-directory-excursion "example_project" + (zero? + (system* + "./manage.py" + "test" + "--verbosity=2" + "--exclude-tag=requires-web" + "django_gravatar")))))))) (inputs `(("python-django" ,python-django))) (home-page "https://github.com/twaddington/django-gravatar") -- cgit v1.2.3