Have the sha module raise a DeprecationWarning as specified in PEP 4.
diff --git a/Lib/test/test_hmac.py b/Lib/test/test_hmac.py
index 9d094d2..d28490d 100644
--- a/Lib/test/test_hmac.py
+++ b/Lib/test/test_hmac.py
@@ -1,5 +1,5 @@
import hmac
-import sha
+from hashlib import sha1
import unittest
from test import test_support
@@ -43,7 +43,7 @@
def test_sha_vectors(self):
def shatest(key, data, digest):
- h = hmac.HMAC(key, data, digestmod=sha)
+ h = hmac.HMAC(key, data, digestmod=sha1)
self.assertEqual(h.hexdigest().upper(), digest.upper())
shatest(chr(0x0b) * 20,
@@ -95,11 +95,11 @@
def test_withmodule(self):
# Constructor call with text and digest module.
- import sha
+ from hashlib import sha1
try:
- h = hmac.HMAC("key", "", sha)
+ h = hmac.HMAC("key", "", sha1)
except:
- self.fail("Constructor call with sha module raised exception.")
+ self.fail("Constructor call with hashlib.sha1 raised exception.")
class SanityTestCase(unittest.TestCase):
diff --git a/Lib/test/test_pep247.py b/Lib/test/test_pep247.py
index 1eb9462..6add210 100644
--- a/Lib/test/test_pep247.py
+++ b/Lib/test/test_pep247.py
@@ -6,6 +6,8 @@
import warnings
warnings.filterwarnings("ignore", "the md5 module is deprecated.*",
DeprecationWarning)
+warnings.filterwarnings("ignore", "the sha module is deprecated.*",
+ DeprecationWarning)
import md5, sha, hmac
diff --git a/Lib/test/test_sha.py b/Lib/test/test_sha.py
index ea224e4..0647db3 100644
--- a/Lib/test/test_sha.py
+++ b/Lib/test/test_sha.py
@@ -4,6 +4,10 @@
# Publication 180-1, Secure Hash Standard, 1995 April 17
# http://www.itl.nist.gov/div897/pubs/fip180-1.htm
+import warnings
+warnings.filterwarnings("ignore", "the sha module is deprecated.*",
+ DeprecationWarning)
+
import sha
import unittest
from test import test_support