From b5a008bac8780098682b50874b81265e53569781 Mon Sep 17 00:00:00 2001 From: Anna Date: Tue, 29 Nov 2022 05:40:28 +0000 Subject: [PATCH] Allow some tests to run without network (#20955) * thttpclient.nim: respect NIM_TESTAMENT_REMOTE_NETWORKING * tnetconnect.nim: respect NIM_TESTAMENT_REMOTE_NETWORKING --- tests/stdlib/thttpclient.nim | 7 +++++-- tests/stdlib/tnetconnect.nim | 4 +++- 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()