aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSharlatan Hellseher <sharlatanus@gmail.com>2025-04-05 17:31:10 +0100
committerAndreas Enge <andreas@enge.fr>2025-04-16 11:46:30 +0200
commitc5a3f8f9c6ab7fda1a4a805aa86a9758b44219ac (patch)
tree77eadbbb97aab1fcaf3de7368cbb2d4b2dcd69f7
parent32b3bcefd1ace4a0aaf5ee87f02b5317d1feb969 (diff)
downloadguix-c5a3f8f9c6ab7fda1a4a805aa86a9758b44219ac.tar.gz
guix-c5a3f8f9c6ab7fda1a4a805aa86a9758b44219ac.zip
gnu: python-dropbox: Enable tests.
* gnu/packages/python-web.scm (python-dropbox): [source]: Swap to git-fetch. [arguments] <tests-flags>: Skip all tests requiring networking. <phases>: Add 'relax-requirements, and 'pre-check. [native-inputs]: Remove python-pytest-runner; add nss-certs-for-test, python-mock, python-pytest-mock, python-setuptools, and python-wheel. Change-Id: I0da3b5a99872dfab9207499ec0f150f52f0b1e4c
-rw-r--r--gnu/packages/python-web.scm70
1 files changed, 57 insertions, 13 deletions
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 5385c78c2c..46cd1ba8fc 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -397,20 +397,64 @@ Async mode for @url{https://domainconnect.org/, Domain Connect protocol}.")
(name "python-dropbox")
(version "12.0.2")
(source
- (origin
- (method url-fetch)
- (uri (pypi-uri "dropbox" version))
- (sha256
- (base32 "0qlrc2ykl7zmv808apqv5ycfzrwnm13ngz1daizh9kszmpapy1ah"))
- (snippet
- '(begin
- (use-modules (guix build utils))
- (substitute* "setup.py"
- (("pytest-runner==5\\.2\\.0") "pytest-runner"))))))
- (build-system python-build-system)
- (arguments '(#:tests? #f)) ; Tests not included in the release tarball.
+ (origin
+ (method git-fetch) ; no tests in PyPI release
+ (uri (git-reference
+ (url "https://github.com/dropbox/dropbox-sdk-python")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0pyvi2mbibah42kq8804d98ghypm46wr8swqr34apnvnlp9j2nzl"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ #~(list "-k" (string-join
+ ;; Network access is required.
+ (list "not test_bad_auth"
+ "test_app_auth"
+ "test_bad_pins"
+ "test_bad_pins_session"
+ "test_downscope"
+ "test_multi_auth"
+ "test_path_root"
+ "test_path_root_err"
+ "test_refresh"
+ "test_rpc"
+ "test_team"
+ "test_upload_download"
+ "test_versioned_route")
+ " and not "))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'relax-requirements
+ (lambda _
+ (substitute* "setup.py"
+ ;; 'stone>=2,<3.3.3',
+ ((">=2,<3.3.3") ">=2,<3.4.0"))))
+ (add-before 'check 'pre-check
+ (lambda _
+ ;; Otherwise tests setup erroring.
+ (setenv "LEGACY_USER_DROPBOX_TOKEN" "guix")
+ (setenv "LEGACY_USER_CLIENT_ID" "guix")
+ (setenv "LEGACY_USER_CLIENT_SECRET" "guix")
+ (setenv "LEGACY_USER_REFRESH_TOKEN" "guix")
+ (setenv "SCOPED_USER_DROPBOX_TOKEN" "guix")
+ (setenv "SCOPED_USER_CLIENT_ID" "guix")
+ (setenv "SCOPED_USER_CLIENT_SECRET" "guix")
+ (setenv "SCOPED_USER_REFRESH_TOKEN" "guix")
+ (setenv "SCOPED_TEAM_DROPBOX_TOKEN" "guix")
+ (setenv "SCOPED_TEAM_CLIENT_ID" "guix")
+ (setenv "SCOPED_TEAM_CLIENT_SECRET" "guix")
+ (setenv "SCOPED_TEAM_REFRESH_TOKEN" "guix")
+ (setenv "DROPBOX_SHARED_LINK" "guix"))))))
(native-inputs
- (list python-pytest python-pytest-runner))
+ (list nss-certs-for-test
+ python-mock
+ python-pytest
+ python-pytest-mock
+ python-setuptools
+ python-wheel))
(propagated-inputs
(list python-requests python-six python-stone))
(home-page "https://www.dropbox.com/developers")