bpo-40275: Move requires_hashdigest() to test.support.hashlib_helper (GH-19716)

Add a new test.support.hashlib_helper submodule.
This commit is contained in:
Hai Shi 2020-04-29 09:11:29 +08:00 committed by GitHub
parent 2208134918
commit 66abe98a81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 71 additions and 68 deletions

View file

@ -11,8 +11,8 @@ import threading
import socket
from test.support import (reap_threads, verbose, transient_internet,
run_with_tz, run_with_locale, cpython_only,
requires_hashdigest)
run_with_tz, run_with_locale, cpython_only)
from test.support import hashlib_helper
import unittest
from unittest import mock
from datetime import datetime, timezone, timedelta
@ -385,7 +385,7 @@ class NewIMAPTestsMixin():
self.assertEqual(code, 'OK')
self.assertEqual(server.response, b'ZmFrZQ==\r\n') # b64 encoded 'fake'
@requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5')
def test_login_cram_md5_bytes(self):
class AuthHandler(SimpleIMAPHandler):
capabilities = 'LOGINDISABLED AUTH=CRAM-MD5'
@ -403,7 +403,7 @@ class NewIMAPTestsMixin():
ret, _ = client.login_cram_md5("tim", b"tanstaaftanstaaf")
self.assertEqual(ret, "OK")
@requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5')
def test_login_cram_md5_plain_text(self):
class AuthHandler(SimpleIMAPHandler):
capabilities = 'LOGINDISABLED AUTH=CRAM-MD5'
@ -849,7 +849,7 @@ class ThreadedNetworkedTests(unittest.TestCase):
b'ZmFrZQ==\r\n') # b64 encoded 'fake'
@reap_threads
@requires_hashdigest('md5')
@hashlib_helper.requires_hashdigest('md5')
def test_login_cram_md5(self):
class AuthHandler(SimpleIMAPHandler):