summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnna <cyber@sysrq.in>2022-11-29 05:40:28 +0000
committerGitHub <noreply@github.com>2022-11-29 06:40:28 +0100
commitb5a008bac8780098682b50874b81265e53569781 (patch)
tree8c4e83ffe49c9e5b6ce329df1eb7cc453b7edb9a
parent15d00ca0e1c0a3c0eb29b6d4500d6915e2446a6f (diff)
downloadNim-b5a008bac8780098682b50874b81265e53569781.tar.gz
Allow some tests to run without network (#20955)
* thttpclient.nim: respect NIM_TESTAMENT_REMOTE_NETWORKING

* tnetconnect.nim: respect NIM_TESTAMENT_REMOTE_NETWORKING
-rw-r--r--tests/stdlib/thttpclient.nim7
-rw-r--r--tests/stdlib/tnetconnect.nim4
2 files changed, 8 insertions, 3 deletions
diff --git a/tests/stdlib/thttpclient.nim b/tests/stdlib/thttpclient.nim
index d2fec6eec..c731c81b0 100644
--- a/tests/stdlib/thttpclient.nim
+++ b/tests/stdlib/thttpclient.nim
@@ -15,6 +15,7 @@ from net import TimeoutError
 import nativesockets, os, httpclient, asyncdispatch
 
 import std/[assertions, syncio]
+from stdtest/testutils import enableRemoteNetworking
 
 const manualTests = false
 
@@ -178,5 +179,7 @@ proc ipv6Test() =
   client.close()
 
 ipv6Test()
-syncTest()
-waitFor(asyncTest())
+
+when enableRemoteNetworking:
+  syncTest()
+  waitFor(asyncTest())
diff --git a/tests/stdlib/tnetconnect.nim b/tests/stdlib/tnetconnect.nim
index 0fff8fdce..ae654aed9 100644
--- a/tests/stdlib/tnetconnect.nim
+++ b/tests/stdlib/tnetconnect.nim
@@ -5,6 +5,7 @@ discard """
 
 import std/net
 from std/strutils import `%`
+from stdtest/testutils import enableRemoteNetworking
 
 # bug #15215
 proc test() =
@@ -25,4 +26,5 @@ proc test() =
   except TimeoutError, OSError:
     fn("www.google.com")
 
-test()
+when enableRemoteNetworking:
+  test()