File: skip_test_with_remote_connection.patch

package info (click to toggle)
pyxnat 1.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,204 kB
  • sloc: python: 6,016; makefile: 28; sh: 17; xml: 11
file content (83 lines) | stat: -rw-r--r-- 2,351 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
74
75
76
77
78
79
80
81
82
83
Description: Exclude tests that need remote access
Author: Andreas Tille <tille@debian.org>
Last-Update: 2018-09-16
Forwarded: not-needed

--- pyxnat.orig/pyxnat/tests/pipelines_test.py
+++ pyxnat/pyxnat/tests/pipelines_test.py
@@ -1,22 +1,26 @@
 import os.path as op
 from pyxnat import Interface
 from pyxnat.core.pipelines import PipelineNotFoundError
+from . import skip_if_no_network
 
 fp = op.abspath('.devxnat.cfg')
 central = Interface(config=fp)
 p = central.select.project('pyxnat_tests')
 
 
+@skip_if_no_network
 def test_pipelines_info():
     info = p.pipelines.info('DicomToNifti')
     assert (len(info) == 1)
 
 
+@skip_if_no_network
 def test_pipelines_aliases():
     aliases = p.pipelines.aliases()
     assert (aliases == {'DicomToNifti': 'DicomToNifti'})
 
 
+@skip_if_no_network
 def test_pipeline_info():
     info_keys = {'appliesTo', 'authors', 'description', 'inputParameters',
                  'path', 'resourceRequirements', 'steps', 'version'}
@@ -28,7 +32,7 @@
     assert (int(pipe_info['version']) >= 20190308)
     assert (set(pipe_info.keys()) == info_keys)
 
-
+@skip_if_no_network
 def test_pipeline_run():
     exp_id = 'BBRCDEV_E03094'
 
@@ -47,7 +51,7 @@
     pipe = p.pipelines.pipeline('DicomToNifti')
     pipe.run(exp_id)
 
-
+@skip_if_no_network
 def test_pipeline_status():
     exp_id = 'BBRCDEV_E03094'
 
--- pyxnat.orig/pyxnat/tests/repr_test.py
+++ pyxnat/pyxnat/tests/repr_test.py
@@ -2,6 +2,7 @@
 from pyxnat import Interface
 import os.path as op
 from pyxnat.tests import skip_if_no_network
+skip_if_no_network()
 
 fp = op.abspath('.devxnat.cfg')
 central = Interface(config=fp)
--- pyxnat.orig/pyxnat/tests/__init__.py
+++ pyxnat/pyxnat/tests/__init__.py
@@ -8,9 +8,10 @@
     If not used as a decorator, and just a function, could be used at the module level
     """
 
-    def check_and_raise():
+    def check_and_raise(module_skip = False):
         if os.environ.get('PYXNAT_SKIP_NETWORK_TESTS'):
-            pytest.skip("Skipping since no network settings")
+            pytest.skip("Skipping since no network settings",
+                        allow_module_level = module_skip)
 
     if func:
         @wraps(func)
@@ -19,4 +20,4 @@
             return func(*args, **kwargs)
         return newfunc
     else:
-        check_and_raise()
+        check_and_raise(module_skip = True)