Patchwork [3,of,7] tests: update test-archive to always use hashlib

login
register
mail settings
Submitter Augie Fackler
Date Aug. 22, 2017, 7:08 p.m.
Message ID <97dba357fcdb6caf5a0f.1503428931@imladris.local>
Download mbox | patch
Permalink /patch/23209/
State Superseded
Headers show

Comments

Augie Fackler - Aug. 22, 2017, 7:08 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1503428272 14400
#      Tue Aug 22 14:57:52 2017 -0400
# Node ID 97dba357fcdb6caf5a0f9f5f074a69306a5a8950
# Parent  6a9a8a60bced4b42a4b019b2f98c97672ce7a42b
tests: update test-archive to always use hashlib

We don't need the fallback to the old modules anymore.

Patch

diff --git a/tests/test-archive.t b/tests/test-archive.t
--- a/tests/test-archive.t
+++ b/tests/test-archive.t
@@ -211,15 +211,12 @@  The '-t' should override autodetection
   > done
 
   $ cat > md5comp.py <<EOF
-  > from __future__ import print_function
-  > try:
-  >     from hashlib import md5
-  > except ImportError:
-  >     from md5 import md5
+  > from __future__ import absolute_import, print_function
+  > import hashlib
   > import sys
   > f1, f2 = sys.argv[1:3]
-  > h1 = md5(open(f1, 'rb').read()).hexdigest()
-  > h2 = md5(open(f2, 'rb').read()).hexdigest()
+  > h1 = hashlib.md5(open(f1, 'rb').read()).hexdigest()
+  > h2 = hashlib.md5(open(f2, 'rb').read()).hexdigest()
   > print(h1 == h2 or "md5 differ: " + repr((h1, h2)))
   > EOF