From 1975da7fb6d8aa4a6046668e7f50918011c22bf9 Mon Sep 17 00:00:00 2001
From: Benjamin Pannell <benjamin@pannell.dev>
Date: Wed, 24 Apr 2024 01:06:44 +0100
Subject: [PATCH] test: Disable network tests in Nix

---
 Cargo.toml         | 1 +
 flake.nix          | 2 +-
 src/targets/dns.rs | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Cargo.toml b/Cargo.toml
index 89ec18c..9be7110 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,4 +32,5 @@ trust-dns-resolver = { version = "0.23", features = ["tokio-runtime"] }
 
 [features]
 default = []
+pure_tests = []
 openssl_src = ["dep:openssl-sys"]
\ No newline at end of file
diff --git a/flake.nix b/flake.nix
index 815d173..c2cd255 100644
--- a/flake.nix
+++ b/flake.nix
@@ -96,7 +96,7 @@
             partitionType = "count";
 
             # Disable impure tests (which access the network and/or filesystem)
-            cargoNextestExtraArgs = "--no-fail-fast";
+            cargoNextestExtraArgs = "--no-fail-fast --features pure_tests";
           };
         };
 
diff --git a/src/targets/dns.rs b/src/targets/dns.rs
index 14bed0b..16f5e83 100644
--- a/src/targets/dns.rs
+++ b/src/targets/dns.rs
@@ -47,6 +47,7 @@ impl Display for DnsTarget {
 }
 
 #[cfg(test)]
+#[cfg(not(feature = "pure_tests"))]
 mod tests {
     use crate::sample::SampleValue;