summaryrefslogtreecommitdiff
path: root/cherrypy
diff options
context:
space:
mode:
authorSviatoslav Sydorenko <wk@sydorenko.org.ua>2019-08-14 12:29:54 +0200
committerSviatoslav Sydorenko <wk@sydorenko.org.ua>2019-08-14 12:29:54 +0200
commitf7d5ba2af8accef9f877171939a06c36a6746178 (patch)
tree87a573c1f6286eb8642af0562314c983d11be712 /cherrypy
parent50957c2e54d05a86594e8eb271207f153195edca (diff)
downloadcherrypy-git-f7d5ba2af8accef9f877171939a06c36a6746178.tar.gz
Fix test_safe_wait_INADDR_ANY w/ filterwarnings
Diffstat (limited to 'cherrypy')
-rw-r--r--cherrypy/test/test_states.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/cherrypy/test/test_states.py b/cherrypy/test/test_states.py
index a5addbca..3f758a28 100644
--- a/cherrypy/test/test_states.py
+++ b/cherrypy/test/test_states.py
@@ -2,7 +2,6 @@ import os
import signal
import time
import unittest
-import warnings
from http.client import BadStatusLine
import pytest
@@ -457,13 +456,13 @@ class WaitTests(unittest.TestCase):
inaddr_any = '0.0.0.0'
# Wait on the free port that's unbound
- with warnings.catch_warnings(record=True) as w:
+ with pytest.warns(
+ UserWarning,
+ match='Unable to verify that the server is bound on ',
+ ) as w:
with servers._safe_wait(inaddr_any, free_port):
portend.occupied(inaddr_any, free_port, timeout=1)
- self.assertEqual(len(w), 1)
- self.assertTrue(isinstance(w[0], warnings.WarningMessage))
- self.assertTrue(
- 'Unable to verify that the server is bound on ' in str(w[0]))
+ assert len(w) == 1
# The wait should still raise an IO error if INADDR_ANY was
# not supplied.