[Python-checkins] bpo-40927: Fix test_binhex when run twice (GH-20764)

Victor Stinner webhook-mailer at python.org
Wed Jun 10 13:54:34 EDT 2020


https://github.com/python/cpython/commit/9c24e2e4c10705d95258558348417a28007dac66
commit: 9c24e2e4c10705d95258558348417a28007dac66
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-06-10T19:54:29+02:00
summary:

bpo-40927: Fix test_binhex when run twice (GH-20764)

test_binhex now uses import_fresh_module() to ensure that it raises
DeprecationWarning each time.

files:
A Misc/NEWS.d/next/Tests/2020-06-09-18-48-18.bpo-40927.67ylLg.rst
M Lib/test/test_binhex.py

diff --git a/Lib/test/test_binhex.py b/Lib/test/test_binhex.py
index 86ca37ce1b99a..859553222a3e9 100644
--- a/Lib/test/test_binhex.py
+++ b/Lib/test/test_binhex.py
@@ -7,7 +7,7 @@
 from test import support
 
 with support.check_warnings(('', DeprecationWarning)):
-    import binhex
+    binhex = support.import_fresh_module('binhex')
 
 
 class BinHexTestCase(unittest.TestCase):
diff --git a/Misc/NEWS.d/next/Tests/2020-06-09-18-48-18.bpo-40927.67ylLg.rst b/Misc/NEWS.d/next/Tests/2020-06-09-18-48-18.bpo-40927.67ylLg.rst
new file mode 100644
index 0000000000000..66209b84c94d6
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2020-06-09-18-48-18.bpo-40927.67ylLg.rst
@@ -0,0 +1,2 @@
+Fix test_binhex when run twice: it now uses import_fresh_module() to ensure
+that it raises DeprecationWarning each time.



More information about the Python-checkins mailing list