Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2ff5328

Browse filesBrowse files
authored
Filter readBody deprecation notice in tests (#947)
* ignore DeprecationWarning. Signed-off-by: kareza <kareza@qq.com>
1 parent 34553ad commit 2ff5328
Copy full SHA for 2ff5328

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed

‎tests/test_twisted.py

Copy file name to clipboardExpand all lines: tests/test_twisted.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from prometheus_client import CollectorRegistry, Counter, generate_latest
44

55
try:
6+
from warnings import filterwarnings
7+
68
from twisted.internet import reactor
79
from twisted.trial.unittest import TestCase
810
from twisted.web.client import Agent, readBody
@@ -40,6 +42,10 @@ def test_reports_metrics(self):
4042
url = f"http://localhost:{port}/metrics"
4143
d = agent.request(b"GET", url.encode("ascii"))
4244

45+
# Ignore expected DeprecationWarning.
46+
filterwarnings("ignore", category=DeprecationWarning, message="Using readBody "
47+
"with a transport that does not have an abortConnection method")
48+
4349
d.addCallback(readBody)
4450
d.addCallback(self.assertEqual, generate_latest(self.registry))
4551

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.