Index: Lib/test/support.py =================================================================== --- Lib/test/support.py (revision 88485) +++ Lib/test/support.py (working copy) @@ -157,8 +157,8 @@ try: attribute = getattr(obj, name) except AttributeError: - raise unittest.SkipTest("module %s has no attribute %s" % ( - obj.__name__, name)) + raise unittest.SkipTest("object %s has no attribute %s" % ( + repr(obj), name)) else: return attribute @@ -471,17 +471,17 @@ if is_temporary: rmtree(name) +if hasattr(os, "umask"): + @contextlib.contextmanager + def temp_umask(umask): + """Context manager that temporarily sets the process umask.""" + oldmask = os.umask(umask) + try: + yield + finally: + os.umask(oldmask) -@contextlib.contextmanager -def temp_umask(umask): - """Context manager that temporarily sets the process umask.""" - oldmask = os.umask(umask) - try: - yield - finally: - os.umask(oldmask) - def findfile(file, here=__file__, subdir=None): """Try to find a file on sys.path and the working directory. If it is not found the argument passed to the function is returned (this does not @@ -862,7 +862,7 @@ with captured_stdout() as s: print("hello") - assert s.getvalue() == "hello" + assert s.getvalue() == "hello\n" """ import io orig_stdout = getattr(sys, stream_name)