File: 0001-Skip-tests-that-require-networking.patch

package info (click to toggle)
tomwer 1.6.7-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 10,716 kB
  • sloc: python: 69,334; makefile: 6
file content (37 lines) | stat: -rw-r--r-- 1,089 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
From: Roland Mas <roland.mas@entierement.net>
Date: Tue, 18 Feb 2025 15:57:28 +0100
Subject: Skip tests that require networking

---
 src/tomwer/tests/datasets.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/tomwer/tests/datasets.py b/src/tomwer/tests/datasets.py
index f7cdf2c..ac107d7 100644
--- a/src/tomwer/tests/datasets.py
+++ b/src/tomwer/tests/datasets.py
@@ -1,6 +1,9 @@
 import os
 from tomoscan.tests.datasets import GitlabProject
 
+import pytest
+
+
 TomwerCIDatasets = GitlabProject(
     branch_name="tomwer",
     host="https://gitlab.esrf.fr",
@@ -11,3 +14,14 @@ TomwerCIDatasets = GitlabProject(
     token=None,
     project_id=4299,  # https://gitlab.esrf.fr/tomotools/ci_datasets
 )
+
+TomwerCIDatasets.get_dataset_orig = TomwerCIDatasets.get_dataset
+
+
+def get_dataset_patched(self, *args, **kwargs):
+    if os.environ.get("_TOMWER_NO_NETWORK_TESTS", "False") == "True":
+        pytest.skip("skipping test when running testsuite offline")
+    self.get_dataset_orig(args, kwargs)
+
+
+TomwerCIDatasets.get_dataset = get_dataset_patched