summaryrefslogtreecommitdiff
path: root/dev-util/pixi/files/pixi-0.39.5-offline-tests.patch
blob: e01a35c196c10fc17b0e54278427d8fbf2501375 (plain)
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
From 6158a713bf285b7817f74e4d4844cc00ee840a4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
Date: Sat, 11 Jan 2025 11:34:49 +0100
Subject: [PATCH] test: add `online_tests` feature to control Internet use

Add an `online_tests` feature that specifically covers tests accessing
the Internet.  It is enabled by default to preserve the existing
behavior, but can be explicitly disabled when running the test suite
entirely offline.

I have not added the respective feature checks to
`slow_integration_tests`, as they all seem to require Internet, so that
seems redundant.

Fixes #2880
---
 Cargo.toml                                  | 4 +++-
 tests/integration_rust/solve_group_tests.rs | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 26a527eb..ddcc4602 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -167,7 +167,7 @@ repository.workspace = true
 version = "0.39.5"
 
 [features]
-default = ["rustls-tls"]
+default = ["online_tests", "rustls-tls"]
 native-tls = [
   "reqwest/native-tls",
   "reqwest/native-tls-alpn",
@@ -175,6 +175,8 @@ native-tls = [
   "rattler/native-tls",
   "pixi_utils/native-tls",
 ]
+# run tests connecting to remote Internet services
+online_tests = []
 rustls-tls = [
   "reqwest/rustls-tls",
   "reqwest/rustls-tls-native-roots",
diff --git a/tests/integration_rust/solve_group_tests.rs b/tests/integration_rust/solve_group_tests.rs
index 5f945bfd..efc5e9e9 100644
--- a/tests/integration_rust/solve_group_tests.rs
+++ b/tests/integration_rust/solve_group_tests.rs
@@ -163,6 +163,7 @@ async fn test_purl_are_added_for_pypi() {
 }
 
 #[tokio::test]
+#[cfg_attr(not(feature = "online_tests"), ignore)]
 async fn test_purl_are_missing_for_non_conda_forge() {
     let pixi = PixiControl::new().unwrap();
     pixi.init().await.unwrap();
@@ -206,6 +207,7 @@ async fn test_purl_are_missing_for_non_conda_forge() {
 }
 
 #[tokio::test]
+#[cfg_attr(not(feature = "online_tests"), ignore)]
 async fn test_purl_are_generated_using_custom_mapping() {
     let pixi = PixiControl::new().unwrap();
     pixi.init().await.unwrap();
@@ -250,6 +252,7 @@ async fn test_purl_are_generated_using_custom_mapping() {
 }
 
 #[tokio::test]
+#[cfg_attr(not(feature = "online_tests"), ignore)]
 async fn test_compressed_mapping_catch_not_pandoc_not_a_python_package() {
     let pixi = PixiControl::new().unwrap();
     pixi.init().await.unwrap();
@@ -290,6 +293,7 @@ async fn test_compressed_mapping_catch_not_pandoc_not_a_python_package() {
 }
 
 #[tokio::test]
+#[cfg_attr(not(feature = "online_tests"), ignore)]
 async fn test_dont_record_not_present_package_as_purl() {
     let pixi = PixiControl::new().unwrap();
     pixi.init().await.unwrap();
-- 
2.47.1