guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#43354] [PATCH 04/55] gnu: python-pytest-django: Update to 3.9.0.


From: Marius Bakke
Subject: [bug#43354] [PATCH 04/55] gnu: python-pytest-django: Update to 3.9.0.
Date: Sat, 12 Sep 2020 16:28:20 +0200

* gnu/packages/django.scm (python-pytest-django): Update to 3.9.0.
[arguments]: Remove #:tests?.  Add phase to run custom tests.
[native-inputs]: Add PYTHON-PYTEST-XDIST and PYTHON-SQLPARSE.
---
 gnu/packages/django.scm | 41 ++++++++++++++++++++++++++++++++---------
 1 file changed, 32 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/django.scm b/gnu/packages/django.scm
index b3abb17277..30716dd286 100644
--- a/gnu/packages/django.scm
+++ b/gnu/packages/django.scm
@@ -309,26 +309,49 @@ size and quality.")
 (define-public python-pytest-django
   (package
     (name "python-pytest-django")
-    (version "3.1.2")
+    (version "3.9.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "pytest-django" version))
               (sha256
                (base32
-                "02932m2sr8x22m4az8syr8g835g4ak77varrnw71n6xakmdcr303"))))
+                "1yds71ppg39whs7pvlbwxfglm0jxyawh33rq34jihpif4i15ykk6"))))
     (build-system python-build-system)
     (arguments
-     `(#:tests? #f ; FIXME: How to run tests?
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'patch-setuppy
-           (lambda _
-             (substitute* "setup.py"
-                          (("setuptools_scm==1.11.1") "setuptools_scm"))
+         (replace 'check
+           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+             (if tests?
+                 (begin
+                   ;; Adjust for Django 3.1, can be removed for versions >= 
3.10.0.
+                   (substitute* "tests/test_fixtures.py"
+                     (("from django\\.conf\\.urls import url")
+                      "from django.urls import path")
+                     (("url\\(r'admin")
+                      "path('admin"))
+                   (add-installed-pythonpath inputs outputs)
+                   (setenv "PYTHONPATH"
+                           (string-append ".:" ;for pytest_django_test
+                                          (getenv "PYTHONPATH")))
+                   (setenv "PYTEST_DJANGO_TEST_RUNNER" "pytest")
+                   (setenv "DJANGO_SETTINGS_MODULE"
+                           "pytest_django_test.settings_sqlite_file")
+                   (invoke "pytest" "-vv" "-k"
+                           ;; FIXME: the settings modules fails to locate 
templates.
+                           (string-append "not 
test_django_not_loaded_without_settings"
+                                          " and not test_settings"
+                                          ;; XXX: Incompatible with Django 3.1?
+                                          " and not 
test_urls_cache_is_cleared")))
+                 (format #t "test suite not run~%"))
              #t)))))
     (native-inputs
      `(("python-django" ,python-django)
-       ("python-setuptools-scm" ,python-setuptools-scm)))
+       ("python-setuptools-scm" ,python-setuptools-scm)
+
+       ;; For tests.
+       ("python-pytest-xdist" ,python-pytest-xdist)
+       ("python-sqlparse" ,python-sqlparse)))  ;XXX: really a Django dependency
     (propagated-inputs
      `(("python-pytest" ,python-pytest)))
     (home-page "https://pytest-django.readthedocs.org/";)
-- 
2.28.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]