Package: mercurial / 6.3.2-1+deb12u1

py310/9_tests__silence_asyncore_smtpd_deprecation_warnings.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# HG changeset patch
# User Julien Cristau <jcristau@debian.org>
# Date 1649671433 -7200
#      Mon Apr 11 12:03:53 2022 +0200
# Node ID d3df32e12246208fc8bb9507ff921099348c6783
# Parent  5005928cac60a43d98d88523713983efdc204d50
tests: silence asyncore/smtpd deprecation warnings

--- a/tests/dummysmtpd.py
+++ b/tests/dummysmtpd.py
@@ -1,19 +1,23 @@
 #!/usr/bin/env python
 
 """dummy SMTP server for use in tests"""
 
 
-import asyncore
 import optparse
-import smtpd
 import ssl
 import sys
 import traceback
+import warnings
+
+with warnings.catch_warnings():
+    warnings.filterwarnings('ignore', 'The (asyncore|smtpd) module is deprecated', DeprecationWarning)
+    import asyncore
+    import smtpd
 
 from mercurial import (
     pycompat,
     server,
     sslutil,
     ui as uimod,
 )