File: 0009-skip-test-without-google-cloud-sdk.patch

package info (click to toggle)
snakemake 7.32.4-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,832 kB
  • sloc: python: 32,846; javascript: 1,287; makefile: 247; sh: 163; ansic: 57; lisp: 9
file content (73 lines) | stat: -rw-r--r-- 2,436 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Description: Skip tests that depend on google-cloud-sdk if not installed

This is not currently in Debian - see RFP #759578.

Author: chrysn <chrysn@fsfe.org>, Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: not-needed

--- a/tests/test_remote_gs/Snakefile
+++ b/tests/test_remote_gs/Snakefile
@@ -1,15 +1,19 @@
-from snakemake.remote import GS
-import google.auth
 try:
-    GS = GS.RemoteProvider()
+    from snakemake.remote import GS
+except WorkflowError:
+    print("skipping test_remote_gs: The Python 3 package 'google-cloud-sdk' needs to be installed to use GS remote() file functionality. No module named 'google.cloud'")
+else:
+    import google.auth
+    try:
+        GS = GS.RemoteProvider()
 
-    rule copy:
-        input:
-            GS.remote("gcp-public-data-landsat/LC08/01/001/003/LC08_L1GT_001003_20170430_20170501_01_RT/LC08_L1GT_001003_20170430_20170501_01_RT_MTL.txt")
-        output:
-            "landsat-data.txt"
-        shell:
-            "cp {input} {output}"
-except google.auth.exceptions.DefaultCredentialsError:
-    # ignore the test if not authenticated
-    print("skipping test_remote_gs because we are not authenticated with gcloud")
+        rule copy:
+            input:
+                GS.remote("gcp-public-data-landsat/LC08/01/001/003/LC08_L1GT_001003_20170430_20170501_01_RT/LC08_L1GT_001003_20170430_20170501_01_RT_MTL.txt")
+            output:
+                "landsat-data.txt"
+            shell:
+                "cp {input} {output}"
+    except google.auth.exceptions.DefaultCredentialsError:
+        # ignore the test if not authenticated
+        print("skipping test_remote_gs because we are not authenticated with gcloud")
--- a/tests/test_google_lifesciences.py
+++ b/tests/test_google_lifesciences.py
@@ -2,18 +2,23 @@ import os
 import requests
 import sys
 import tempfile
-import google.auth
+import pytest
 
-from google.cloud import storage
+try:
+    import google.auth
+    from google.cloud import storage
+    def has_google_credentials():
+        credentials, _ = google.auth.default()
+        return credentials
+except ImportError:
+    def has_google_credentials():
+        return False # will skip due to no credentials
 
 sys.path.insert(0, os.path.dirname(__file__))
 
 from common import *
 
 
-def has_google_credentials():
-    credentials, _ = google.auth.default()
-    return credentials
 
 
 google_credentials = pytest.mark.skipif(