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

package info (click to toggle)
snakemake 7.21.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 25,052 kB
  • sloc: python: 30,995; javascript: 1,290; makefile: 247; sh: 163; ansic: 57; lisp: 9
file content (58 lines) | stat: -rw-r--r-- 2,046 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
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
@@ -1,8 +1,12 @@
 import os
 import sys
 import tempfile
+import pytest
 
-from google.cloud import storage
+try:
+    from google.cloud import storage
+except ImportError:
+    pass # will skip due to no credentials
 
 sys.path.insert(0, os.path.dirname(__file__))