Subject: [PATCH v3 09/21] gnu: python-aws-sam-translator: Change source for tests.

From: Vinicius Monego <[email-masked]>
Date: Thu, 16 Sep 2021 16:21:00 +0000

* gnu/packages/python-web.scm (python-aws-sam-translator)[source]: Fetch from
GitHub. Make some cosmetic changes.
[arguments]: Change explanation on why tests are disabled. Make some cosmetic
changes.
[native-inputs]: Add python-black, python-click, python-coverage,
python-dateparser, python-docopt, python-flake8, python-mock,
python-parameterized, python-pathlib2, python-pylint, python-pytest,
python-pytest-cov, python-pyyaml, python-requests.
---
 gnu/packages/python-web.scm | 57 +++++++++++++++++++++++++------------
 1 file changed, 39 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 5449911f3f..fc3f1473af 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -377,26 +377,47 @@ WSGI.  This package includes libraries for implementing ASGI servers.")
   (package
     (name "python-aws-sam-translator")
     (version "1.38.0")
-    (source (origin
-              (method url-fetch)
-              (uri (pypi-uri "aws-sam-translator" version))
-              (sha256
-               (base32
-                "1djwlsjpbh13m4biglimrm9lq7hmla0k29giay7k3cjsrylxvjhf"))))
+    (source
+     (origin
+       ;; PyPI tarball does not include tests.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/aws/serverless-application-model")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0nn9jfqz13kzmxm0r9vy24p8sqxv3mrm5d3lx7ah6rc581q8nv1k"))))
     (build-system python-build-system)
     (arguments
-     `(;; XXX: Tests are not distributed with the PyPI archive, and would
-       ;; introduce a circular dependency on python-cfn-lint.
-       #:tests? #f
-       #:phases (modify-phases %standard-phases
-                  (add-after 'unpack 'loosen-requirements
-                    (lambda _
-                      ;; The package needlessly specifies exact versions
-                      ;; of dependencies, when it works fine with others.
-                      (substitute* "requirements/base.txt"
-                        (("(.*)(~=[0-9\\.]+)" all package version)
-                         package))
-                      #t)))))
+     ;; FIXME: 25 test failures divided in the following two errors:
+     ;; 'botocore.exceptions.NoRegionError: You must specify a region.'
+     ;; AttributeError: 'TestDeploymentPreferenceCollection' object has
+     ;; no attribute 'function_logical_id'.
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'loosen-requirements
+           (lambda _
+             ;; The package needlessly specifies exact versions
+             ;; of dependencies, when it works fine with others.
+             (substitute* "requirements/base.txt"
+               (("(.*)(~=[0-9\\.]+)" all package version)
+                package)))))))
+    (native-inputs
+     `(("python-black" ,python-black)
+       ("python-click" ,python-click)
+       ("python-coverage" ,python-coverage)
+       ("python-dateparser" ,python-dateparser)
+       ("python-docopt" ,python-docopt)
+       ("python-flake8" ,python-flake8)
+       ("python-mock" ,python-mock)
+       ("python-parameterized" ,python-parameterized)
+       ("python-pathlib2" ,python-pathlib2)
+       ("python-pylint" ,python-pylint)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-requests" ,python-requests)))
     (propagated-inputs
      `(("python-boto3" ,python-boto3)
        ("python-jsonschema" ,python-jsonschema)
-- 
2.30.2