Blob Blame History Raw
From d38ac714e4e1ab9a4a8fdf324fbe24c53b90120a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dan.cermak@cgc-instruments.com>
Date: Thu, 28 Jan 2021 21:17:29 +0100
Subject: [PATCH 3/3] Add network mark to getaddrinfo test

Calling getaddrinfo in a builder without network access results in an error as
it cannot contact a DNS server. The network marker is used by convention to mark
such tests and allows this test to be skipped.

(cherry picked from commit fc60d9172aa838cecc9dcb97ce60dbfe86e4b8c5)
---
 pyproject.toml        | 3 +++
 tests/test_sockets.py | 1 +
 2 files changed, 4 insertions(+)

diff --git a/pyproject.toml b/pyproject.toml
index f4718d2..6ad27a0 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -23,6 +23,9 @@ max_line_length = 99
 addopts = "-rsx --tb=short"
 testpaths = ["tests"]
 filterwarnings = "always"
+markers = [
+    "network",
+]
 
 [tool.coverage.run]
 source = ["anyio"]
diff --git a/tests/test_sockets.py b/tests/test_sockets.py
index 24e59b7..058812a 100644
--- a/tests/test_sockets.py
+++ b/tests/test_sockets.py
@@ -807,6 +807,7 @@ class TestConnectedUDPSocket:
             await udp.send(b'foo')
 
 
+@pytest.mark.network
 async def test_getaddrinfo():
     # IDNA 2003 gets this wrong
     correct = await getaddrinfo('faß.de', 0)
-- 
2.29.2