File: internet-tests.patch

package info (click to toggle)
python-trx-python 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 588 kB
  • sloc: python: 4,656; makefile: 15
file content (281 lines) | stat: -rw-r--r-- 11,102 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
Description: skip tests that need Internet.
 A number of tests involve the data fetcher which requires Internet to get the
 resources.  Since this is forbiddent at build time, and discouraged at debci
 time, let's skip them altogether.  One can tell whether a test needs the
 remote resource, because the code to download them is deleted, and thus newly
 introduced tests will fail with errors like:
 .
        E           ValueError: File/Folder does not exist

Author: Étienne Mollier <emollier@debian.org>
Forwarded: not-needed
Last-Update: 2023-12-31
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- python-trx-python.orig/trx/tests/test_io.py
+++ python-trx-python/trx/tests/test_io.py
@@ -22,9 +22,9 @@
 import trx.trx_file_memmap as tmm
 from trx.trx_file_memmap import TrxFile
 
-fetch_data(get_testing_files_dict(), keys=["gold_standard.zip"])
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 @pytest.mark.parametrize("path", [("gs.trk"), ("gs.tck"), ("gs.vtk")])
 @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
 def test_seq_ops_sft(path):
@@ -41,6 +41,7 @@
         _ = load_tractogram(os.path.join(tmp_dir, "tmp.trk"), "same")
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 def test_seq_ops_trx():
     with TemporaryDirectory() as tmp_dir:
         gs_dir = os.path.join(get_home(), "gold_standard")
@@ -53,6 +54,7 @@
         trx_2.close()
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 @pytest.mark.parametrize("path", [("gs.trx"), ("gs.trk"), ("gs.tck"), ("gs.vtk")])
 @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
 def test_load_vox(path):
@@ -69,6 +71,7 @@
         obj.close()
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 @pytest.mark.parametrize("path", [("gs.trx"), ("gs.trk"), ("gs.tck"), ("gs.vtk")])
 @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
 def test_load_voxmm(path):
@@ -85,6 +88,7 @@
         obj.close()
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 @pytest.mark.parametrize("path", [("gs.trk"), ("gs.trx"), ("gs_fldr.trx")])
 @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
 def test_multi_load_save_rasmm(path):
@@ -111,6 +115,7 @@
             obj.close()
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 @pytest.mark.parametrize("path", [("gs.trx"), ("gs_fldr.trx")])
 @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
 def test_delete_tmp_gs_dir(path):
@@ -152,6 +157,7 @@
     trx3.close()
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 @pytest.mark.parametrize("path", [("gs.trx")])
 @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
 def test_close_tmp_files(path):
@@ -191,6 +197,7 @@
 
 
 @pytest.mark.parametrize("tmp_path", [("~"), ("use_working_dir")])
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 def test_change_tmp_dir(tmp_path):
     gs_dir = os.path.join(get_home(), "gold_standard")
     path = os.path.join(gs_dir, "gs.trx")
@@ -213,6 +220,7 @@
 
 
 @pytest.mark.parametrize("path", [("gs.trx"), ("gs_fldr.trx")])
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 def test_complete_dir_from_trx(path):
     gs_dir = os.path.join(get_home(), "gold_standard")
     path = os.path.join(gs_dir, path)
@@ -242,6 +250,7 @@
     assert set(file_paths) == set(expected_content)
 
 
+@pytest.mark.skip(reason='requires gold_standard which needs internet')
 def test_complete_zip_from_trx():
     gs_dir = os.path.join(get_home(), "gold_standard")
     path = os.path.join(gs_dir, "gs.trx")
--- python-trx-python.orig/trx/tests/test_memmap.py
+++ python-trx-python/trx/tests/test_memmap.py
@@ -22,7 +22,6 @@
 from trx.io import get_trx_tmp_dir
 import trx.trx_file_memmap as tmm
 
-fetch_data(get_testing_files_dict(), keys=["memmap_test_data.zip"])
 tmp_dir = get_trx_tmp_dir()
 
 
@@ -155,6 +154,7 @@
         ("dontexist.trx", False, True),
     ],
 )
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 def test_load(path, check_dpg, value_error):
     path = os.path.join(get_home(), "memmap_test_data", path)
     # Need to perhaps improve test
@@ -167,18 +167,21 @@
         assert isinstance(tmm.load(input_obj=path, check_dpg=check_dpg), tmm.TrxFile)
 
 
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 @pytest.mark.parametrize("path", [("small.trx")])
 def test_load_zip(path):
     path = os.path.join(get_home(), "memmap_test_data", path)
     assert isinstance(tmm.load_from_zip(path), tmm.TrxFile)
 
 
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 @pytest.mark.parametrize("path", [("small_fldr.trx")])
 def test_load_directory(path):
     path = os.path.join(get_home(), "memmap_test_data", path)
     assert isinstance(tmm.load_from_directory(path), tmm.TrxFile)
 
 
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 @pytest.mark.parametrize("path", [("small.trx")])
 def test_concatenate(path):
     path = os.path.join(get_home(), "memmap_test_data", path)
@@ -193,6 +196,7 @@
 
 
 @pytest.mark.parametrize("path", [("small.trx")])
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 def test_resize(path):
     path = os.path.join(get_home(), "memmap_test_data", path)
     trx1 = tmm.load(path)
@@ -206,6 +210,7 @@
     concat.close()
 
 
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 @pytest.mark.parametrize("path, buffer", [("small.trx", 10000), ("small.trx", 0)])
 def test_append(path, buffer):
     path = os.path.join(get_home(), "memmap_test_data", path)
@@ -223,6 +228,7 @@
 
 @pytest.mark.parametrize("path, buffer", [("small.trx", 10000)])
 @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed")
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 def test_append_StatefulTractogram(path, buffer):
     path = os.path.join(get_home(), "memmap_test_data", path)
     trx = tmm.load(path)
@@ -239,6 +245,7 @@
 
 
 @pytest.mark.parametrize("path, buffer", [("small.trx", 10000)])
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 def test_append_Tractogram(path, buffer):
     path = os.path.join(get_home(), "memmap_test_data", path)
     trx = tmm.load(path)
@@ -254,6 +261,7 @@
     concat.close()
 
 
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 @pytest.mark.parametrize(
     "path, size, buffer",
     [
@@ -398,6 +406,7 @@
     pass
 
 
+@pytest.mark.skip(reason='requires memmap_test_data which needs internet')
 @pytest.mark.parametrize("path", [("small.trx")])
 def test_close_releases_mmap_from_zip(path):
     """close() must release mmap handles even when loaded via load_from_zip()."""
--- python-trx-python.orig/trx/tests/test_cli.py
+++ python-trx-python/trx/tests/test_cli.py
@@ -26,11 +26,6 @@
     validate_tractogram,
 )
 
-# If they already exist, this only takes 5 seconds (check md5sum)
-fetch_data(
-    get_testing_files_dict(),
-    keys=["DSI.zip", "trx_from_scratch.zip", "gold_standard.zip"],
-)
 
 
 def _normalize_dtype_dict(dtype_dict):
@@ -147,6 +142,7 @@
         ret = script_runner.run(["trx", "info", "--help"])
         assert ret.success
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     def test_trx_info_execution(self, script_runner):
         """Test trx info command execution on a real TRX file."""
         trx_path = os.path.join(get_home(), "gold_standard", "gs.trx")
@@ -159,6 +155,7 @@
         assert "vertex_count" in ret.stdout
         assert "Archive contents:" in ret.stdout
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     def test_trx_info_wrong_extension(self, script_runner):
         """Test trx info rejects non-TRX files."""
         tck_path = os.path.join(get_home(), "gold_standard", "gs.tck")
@@ -178,6 +175,7 @@
     """Tests for workflow functions."""
 
     @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
+    @pytest.mark.skip(reason='requires test data which need internet')
     def test_execution_convert_dsi(self):
         with tempfile.TemporaryDirectory() as tmp_dir:
             in_trk = os.path.join(get_home(), "DSI", "CC.trk.gz")
@@ -196,6 +194,7 @@
             assert_equal(sft.streamlines._data, data_fix)
             assert_equal(sft.streamlines._offsets, offsets_fix)
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
     def test_execution_convert_to_trx(self):
         with tempfile.TemporaryDirectory() as tmp_dir:
@@ -215,6 +214,7 @@
             assert_array_equal(trx.streamlines._offsets, offsets_fix)
             trx.close()
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
     def test_execution_convert_from_trx(self):
         with tempfile.TemporaryDirectory() as tmp_dir:
@@ -242,6 +242,7 @@
             assert_equal(sft.streamlines._data, data_fix)
             assert_equal(sft.streamlines._offsets, offsets_fix)
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
     def test_execution_convert_dtype_p16_o64(self):
         with tempfile.TemporaryDirectory() as tmp_dir:
@@ -260,6 +261,7 @@
             assert_equal(trx.streamlines._offsets.dtype, np.uint64)
             trx.close()
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
     def test_execution_convert_dtype_p64_o32(self):
         with tempfile.TemporaryDirectory() as tmp_dir:
@@ -278,6 +280,7 @@
             assert_equal(trx.streamlines._offsets.dtype, np.uint32)
             trx.close()
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     def test_execution_generate_trx_from_scratch(self):
         with tempfile.TemporaryDirectory() as tmp_dir:
             reference_fa = os.path.join(get_home(), "trx_from_scratch", "fa.nii.gz")
@@ -364,6 +367,7 @@
             exp_trx.close()
             gen_trx.close()
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
     def test_execution_concatenate_validate_trx(self):
         with tempfile.TemporaryDirectory() as tmp_dir:
@@ -423,6 +427,7 @@
             trx2.close()
             trx_val.close()
 
+    @pytest.mark.skip(reason='requires test data which need internet')
     @pytest.mark.skipif(not dipy_available, reason="Dipy is not installed.")
     def test_execution_manipulate_trx_datatype(self):
         with tempfile.TemporaryDirectory() as tmp_dir: