cpython: eafe4007c999 (original) (raw)

--- a/Lib/test/test_tools.py +++ b/Lib/test/test_tools.py @@ -16,7 +16,7 @@ import sysconfig import tempfile import textwrap from test import support -from test.script_helper import assert_python_ok, temp_dir +from test.script_helper import assert_python_ok, assert_python_failure if not sysconfig.is_python_build(): # XXX some installers do contain the tools, should we detect that @@ -61,7 +61,7 @@ class PindentTests(unittest.TestCase): def test_selftest(self): self.maxDiff = None

@@ -367,7 +367,7 @@ class TestSundryScripts(unittest.TestCas # added for a script it should be added to the whitelist below. # scripts that have independent tests.

@@ -450,16 +450,74 @@ class Gprof2htmlTests(unittest.TestCase) self.assertTrue(wmock.open.called) +class MD5SumTests(unittest.TestCase): +

+

+

+

+

+

+

+

+

+ +

Run the tests in Tools/parser/test_unparse.py

with support.DirsOnSysPath(os.path.join(basepath, 'parser')): from test_unparse import UnparseTestCase from test_unparse import DirectoryTestCase - -def test_main():

- - if name == 'main': unittest.main()

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -1,4 +1,4 @@ -+++++++++++ ++++++++++++ Python News +++++++++++ @@ -227,6 +227,9 @@ Windows Tools/Demos ----------- +- Issue #21906: Make Tools/scripts/md5sum.py work in Python 3.

--- a/Tools/scripts/md5sum.py +++ b/Tools/scripts/md5sum.py @@ -9,7 +9,7 @@ fnfilter = None rmode = 'rb' usage = """ -usage: sum5 [-b] [-t] [-l] [-s bufsize] [file ...] +usage: md5sum.py [-b] [-t] [-l] [-s bufsize] [file ...] -b : read files in binary mode (default) -t : read files in text mode (you almost certainly don't want this!) -l : print last pathname component only @@ -17,6 +17,7 @@ usage: sum5 [-b] [-t] [-l] [-s bufsize] file ... : files to sum; '-' or no files means stdin """ % bufsize +import io import sys import os import getopt @@ -24,7 +25,7 @@ from hashlib import md5 def sum(*files): sts = 0

@@ -53,12 +54,14 @@ def printsum(filename, out=sys.stdout): return sts def printsumfp(fp, filename, out=sys.stdout):