Commit 3522e040 authored by Florent Xicluna's avatar Florent Xicluna

Merged revisions 79195,79425,79427,79450 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r79195 | florent.xicluna | 2010-03-21 13:27:20 +0100 (dim, 21 mar 2010) | 2 lines

  Issue #8179: Fix macpath.realpath() on a non-existing path.
........
  r79425 | florent.xicluna | 2010-03-25 21:32:07 +0100 (jeu, 25 mar 2010) | 2 lines

  Syntax cleanup `== None` -> `is None`
........
  r79427 | florent.xicluna | 2010-03-25 21:39:10 +0100 (jeu, 25 mar 2010) | 2 lines

  Fix test_unittest and test_warnings when running "python -Werror -m test.regrtest"
........
  r79450 | florent.xicluna | 2010-03-26 20:32:44 +0100 (ven, 26 mar 2010) | 2 lines

  Ensure that the failed or unexpected tests are sorted before printing.
........
parent cbf32718
...@@ -783,7 +783,7 @@ class TurtleScreenBase(object): ...@@ -783,7 +783,7 @@ class TurtleScreenBase(object):
# needs amendment # needs amendment
if not isinstance(self.cv, ScrolledCanvas): if not isinstance(self.cv, ScrolledCanvas):
return self.canvwidth, self.canvheight return self.canvwidth, self.canvheight
if canvwidth is None and canvheight is None and bg is None: if canvwidth is canvheight is bg is None:
return self.cv.canvwidth, self.cv.canvheight return self.cv.canvwidth, self.cv.canvheight
if canvwidth is not None: if canvwidth is not None:
self.canvwidth = canvwidth self.canvwidth = canvwidth
...@@ -999,7 +999,7 @@ class TurtleScreen(TurtleScreenBase): ...@@ -999,7 +999,7 @@ class TurtleScreen(TurtleScreenBase):
>>> mode() >>> mode()
'logo' 'logo'
""" """
if mode == None: if mode is None:
return self._mode return self._mode
mode = mode.lower() mode = mode.lower()
if mode not in ["standard", "logo", "world"]: if mode not in ["standard", "logo", "world"]:
...@@ -1339,7 +1339,7 @@ class TurtleScreen(TurtleScreenBase): ...@@ -1339,7 +1339,7 @@ class TurtleScreen(TurtleScreenBase):
### repeatedly pressing the up-arrow key, ### repeatedly pressing the up-arrow key,
### consequently drawing a hexagon ### consequently drawing a hexagon
""" """
if fun == None: if fun is None:
if key in self._keys: if key in self._keys:
self._keys.remove(key) self._keys.remove(key)
elif key not in self._keys: elif key not in self._keys:
...@@ -1460,7 +1460,7 @@ class TNavigator(object): ...@@ -1460,7 +1460,7 @@ class TNavigator(object):
def _setmode(self, mode=None): def _setmode(self, mode=None):
"""Set turtle-mode to 'standard', 'world' or 'logo'. """Set turtle-mode to 'standard', 'world' or 'logo'.
""" """
if mode == None: if mode is None:
return self._mode return self._mode
if mode not in ["standard", "logo", "world"]: if mode not in ["standard", "logo", "world"]:
return return
...@@ -2704,7 +2704,7 @@ class RawTurtle(TPen, TNavigator): ...@@ -2704,7 +2704,7 @@ class RawTurtle(TPen, TNavigator):
>>> turtle.shapesize(5, 5, 12) >>> turtle.shapesize(5, 5, 12)
>>> turtle.shapesize(outline=8) >>> turtle.shapesize(outline=8)
""" """
if stretch_wid is None and stretch_len is None and outline == None: if stretch_wid is stretch_len is outline is None:
stretch_wid, stretch_len = self._stretchfactor stretch_wid, stretch_len = self._stretchfactor
return stretch_wid, stretch_len, self._outlinewidth return stretch_wid, stretch_len, self._outlinewidth
if stretch_wid is not None: if stretch_wid is not None:
......
...@@ -206,7 +206,10 @@ def realpath(path): ...@@ -206,7 +206,10 @@ def realpath(path):
path = components[0] + ':' path = components[0] + ':'
for c in components[1:]: for c in components[1:]:
path = join(path, c) path = join(path, c)
try:
path = Carbon.File.FSResolveAliasFile(path, 1)[0].as_pathname() path = Carbon.File.FSResolveAliasFile(path, 1)[0].as_pathname()
except Carbon.File.Error:
pass
return path return path
supports_unicode_filenames = False supports_unicode_filenames = False
...@@ -399,11 +399,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False, ...@@ -399,11 +399,6 @@ def main(tests=None, testdir=None, verbose=0, quiet=False,
if module not in save_modules and module.startswith("test."): if module not in save_modules and module.startswith("test."):
test_support.unload(module) test_support.unload(module)
# The lists won't be sorted if running with -r
good.sort()
bad.sort()
skipped.sort()
if good and not quiet: if good and not quiet:
if not bad and not skipped and len(good) > 1: if not bad and not skipped and len(good) > 1:
print "All", print "All",
...@@ -757,7 +752,8 @@ def printlist(x, width=70, indent=4): ...@@ -757,7 +752,8 @@ def printlist(x, width=70, indent=4):
from textwrap import fill from textwrap import fill
blanks = ' ' * indent blanks = ' ' * indent
print fill(' '.join(map(str, x)), width, # Print the sorted list: 'x' may be a '--random' list or a set()
print fill(' '.join(str(elt) for elt in sorted(x)), width,
initial_indent=blanks, subsequent_indent=blanks) initial_indent=blanks, subsequent_indent=blanks)
# Map sys.platform to a string containing the basenames of tests # Map sys.platform to a string containing the basenames of tests
......
...@@ -37,11 +37,15 @@ def warnings_state(module): ...@@ -37,11 +37,15 @@ def warnings_state(module):
except NameError: except NameError:
pass pass
original_warnings = warning_tests.warnings original_warnings = warning_tests.warnings
original_filters = module.filters
try: try:
module.filters = original_filters[:]
module.simplefilter("once")
warning_tests.warnings = module warning_tests.warnings = module
yield yield
finally: finally:
warning_tests.warnings = original_warnings warning_tests.warnings = original_warnings
module.filters = original_filters
class BaseTest(unittest.TestCase): class BaseTest(unittest.TestCase):
...@@ -204,6 +208,7 @@ class WarnTests(unittest.TestCase): ...@@ -204,6 +208,7 @@ class WarnTests(unittest.TestCase):
def test_message(self): def test_message(self):
with original_warnings.catch_warnings(record=True, with original_warnings.catch_warnings(record=True,
module=self.module) as w: module=self.module) as w:
self.module.simplefilter("once")
for i in range(4): for i in range(4):
text = 'multi %d' %i # Different text on each call. text = 'multi %d' %i # Different text on each call.
self.module.warn(text) self.module.warn(text)
......
...@@ -23,6 +23,8 @@ Core and Builtins ...@@ -23,6 +23,8 @@ Core and Builtins
Library Library
------- -------
- Issue #8179: Fix macpath.realpath() on a non-existing path.
- Issue #7667: Fix doctest failures with non-ASCII paths. - Issue #7667: Fix doctest failures with non-ASCII paths.
- Issue #7624: Fix isinstance(foo(), collections.Callable) for old-style - Issue #7624: Fix isinstance(foo(), collections.Callable) for old-style
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment