Skip to content

Commit 040bbcd

Browse files
mceplmvantellingen
authored andcommitted
Add a network pytest mark for tests that use the network
Fixes: #1402
1 parent 6ba7d2e commit 040bbcd

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ testpaths = [
2828
]
2929
markers = [
3030
# mark a test to allow socket usage
31-
"requests"
31+
"requests",
32+
"network: test case requires network connection",
3233
]

tests/test_cache.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ def test_no_records(self, tmpdir):
3434
result = c.get("http://tests.python-zeep.org/example.wsdl")
3535
assert result is None
3636

37+
@pytest.mark.network
3738
def test_has_expired(self, tmpdir):
3839
c = cache.SqliteCache(path=tmpdir.join("sqlite.cache.db").strpath)
3940
c.add("http://tests.python-zeep.org/example.wsdl", b"content")
@@ -50,6 +51,7 @@ def test_has_not_expired(self, tmpdir):
5051
assert result == b"content"
5152

5253

54+
@pytest.mark.network
5355
def test_memory_cache_timeout(tmpdir):
5456
c = cache.InMemoryCache()
5557
c.add("http://tests.python-zeep.org/example.wsdl", b"content")
@@ -75,13 +77,15 @@ class TestIsExpired:
7577
def test_timeout_none(self):
7678
assert cache._is_expired(100, None) is False
7779

80+
@pytest.mark.network
7881
def test_has_expired(self):
7982
timeout = 7200
8083
utcnow = datetime.datetime.now(datetime.timezone.utc)
8184
value = utcnow + datetime.timedelta(seconds=timeout)
8285
with freezegun.freeze_time(utcnow):
8386
assert cache._is_expired(value, timeout) is False
8487

88+
@pytest.mark.network
8589
def test_has_not_expired(self):
8690
timeout = 7200
8791
utcnow = datetime.datetime.now(datetime.timezone.utc)

tests/test_wsse_username.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def test_password_text():
8585
assert_nodes_equal(envelope, expected)
8686

8787

88+
@pytest.mark.network
8889
@freeze_time("2016-05-08 12:00:00")
8990
def test_password_digest(monkeypatch):
9091
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")
@@ -138,6 +139,7 @@ def test_password_digest(monkeypatch):
138139
assert_nodes_equal(envelope, expected)
139140

140141

142+
@pytest.mark.network
141143
@freeze_time("2016-05-08 12:00:00")
142144
def test_password_digest_custom(monkeypatch):
143145
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")
@@ -323,6 +325,7 @@ def test_timestamp_token():
323325
assert_nodes_equal(envelope, expected)
324326

325327

328+
@pytest.mark.network
326329
@freeze_time("2016-05-08 12:00:00")
327330
def test_bytes_like_password_digest(monkeypatch):
328331
monkeypatch.setattr(os, "urandom", lambda x: b"mocked-random")

0 commit comments

Comments
 (0)