diff --git a/tests/test_twisted.py b/tests/test_twisted.py index 3f72d1b1..e63c903e 100644 --- a/tests/test_twisted.py +++ b/tests/test_twisted.py @@ -3,6 +3,8 @@ from prometheus_client import CollectorRegistry, Counter, generate_latest try: + from warnings import filterwarnings + from twisted.internet import reactor from twisted.trial.unittest import TestCase from twisted.web.client import Agent, readBody @@ -40,6 +42,10 @@ def test_reports_metrics(self): url = f"http://localhost:{port}/metrics" d = agent.request(b"GET", url.encode("ascii")) + # Ignore expected DeprecationWarning. + filterwarnings("ignore", category=DeprecationWarning, message="Using readBody " + "with a transport that does not have an abortConnection method") + d.addCallback(readBody) d.addCallback(self.assertEqual, generate_latest(self.registry))