Skip to content

Commit b8fc5f4

Browse files
Fix for platforms with ordered tests
1 parent e4036f8 commit b8fc5f4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_email/test_headerregistry.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,11 @@ def content_type_as_value(self,
247247
decoded = args[2] if l>2 and args[2] is not DITTO else source
248248
header = 'Content-Type:' + ' ' if source else ''
249249
folded = args[3] if l>3 else header + decoded + '\n'
250-
# Suppress deprecation warning for rfc2231_nonascii_in_charset_of_charset_parameter_value
251-
if 'utf-8%E2%80%9D' in source and not 'ascii' in source:
250+
# Both rfc2231 test cases with utf-8%E2%80%9D raise warnings,
251+
# clear encoding cache to ensure test isolation.
252+
if 'utf-8%E2%80%9D' in source:
253+
import encodings
254+
encodings._cache.clear()
252255
with self.assertWarns(DeprecationWarning):
253256
h = self.make_header('Content-Type', source)
254257
else:

0 commit comments

Comments
 (0)