summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2008-05-16 04:39:54 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2008-05-16 04:39:54 (GMT)
commite9f305fd16fb38fd6255303b9607f227ee219693 (patch)
treea85269a3a5b50ce41071751896be41a14a7cabd2 /Lib
parent7203d0fbba7b220258eb4879b9091541bb8a840b (diff)
downloadcpython-e9f305fd16fb38fd6255303b9607f227ee219693.zip
cpython-e9f305fd16fb38fd6255303b9607f227ee219693.tar.gz
cpython-e9f305fd16fb38fd6255303b9607f227ee219693.tar.bz2
Merged revisions 63208-63209,63211-63212,63214-63217,63219-63224,63226-63227,63229-63232,63234-63235,63237-63239,63241,63243-63246,63250-63254,63256-63259,63261,63263-63264,63266-63267,63269-63270,63272-63273,63275-63276,63278,63280-63281,63283-63284,63286-63287,63289-63290,63292-63293,63295-63296,63298-63299,63301-63302,63304-63305,63307,63309-63314,63316-63322,63324-63325,63327-63335,63337-63338,63340-63342,63344-63346,63348 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r63208 | georg.brandl | 2008-05-13 15:04:54 -0400 (Tue, 13 May 2008) | 2 lines #2831: add start argument to enumerate(). Patch by Scott Dial and me. ........ r63209 | marc-andre.lemburg | 2008-05-13 15:10:45 -0400 (Tue, 13 May 2008) | 3 lines Remove leftovers from reverted setuptools checkin (they were added in r45525). ........ r63211 | georg.brandl | 2008-05-13 17:32:03 -0400 (Tue, 13 May 2008) | 2 lines Fix a refleak in the _warnings module. ........ r63212 | andrew.kuchling | 2008-05-13 20:46:41 -0400 (Tue, 13 May 2008) | 1 line List all the removes and renamed modules ........ r63214 | brett.cannon | 2008-05-13 21:09:40 -0400 (Tue, 13 May 2008) | 2 lines Rewrap some lines in test_py3kwarn. ........ r63219 | georg.brandl | 2008-05-14 02:34:15 -0400 (Wed, 14 May 2008) | 2 lines Add NEWS entry for #2831. ........ r63220 | neal.norwitz | 2008-05-14 02:47:56 -0400 (Wed, 14 May 2008) | 3 lines Fix "refleak" by restoring the tearDown method removed by accident (AFAICT) in r62788. ........ r63221 | georg.brandl | 2008-05-14 03:18:22 -0400 (Wed, 14 May 2008) | 2 lines Fix another "refleak" by clearing the filters after test. ........ r63222 | neal.norwitz | 2008-05-14 03:21:42 -0400 (Wed, 14 May 2008) | 5 lines Install the json package and tests as well as the lib2to3 tests so the tests work when run from an install directory. They are currently skipped on the daily runs (not from the buildbots) for checking refleaks, etc. ........ r63256 | andrew.kuchling | 2008-05-14 21:10:24 -0400 (Wed, 14 May 2008) | 1 line Note some removals and a rename ........ r63311 | brett.cannon | 2008-05-15 00:36:53 -0400 (Thu, 15 May 2008) | 2 lines Add a snippet for the deprecation directive for docs. ........ r63313 | gregory.p.smith | 2008-05-15 00:56:18 -0400 (Thu, 15 May 2008) | 5 lines disable the crashing test. I will also file a bug. This crash does not appear to be a new bug, its just that the test coverage went up recently exposing it. (I verified that by testing this test code on an older Modules/_bsddb.c) ........ r63320 | georg.brandl | 2008-05-15 11:08:32 -0400 (Thu, 15 May 2008) | 2 lines #2863: add gen.__name__ and add this name to generator repr(). ........ r63324 | andrew.kuchling | 2008-05-15 16:07:39 -0400 (Thu, 15 May 2008) | 1 line Import class from distutils.cmd, not .core, to avoid circular import ........ r63327 | alexandre.vassalotti | 2008-05-15 16:31:42 -0400 (Thu, 15 May 2008) | 2 lines Fixed typo in a doctest of test_genexps. ........ r63332 | benjamin.peterson | 2008-05-15 18:34:33 -0400 (Thu, 15 May 2008) | 2 lines add Mac modules to the list of deprecated ones ........ r63333 | benjamin.peterson | 2008-05-15 18:41:16 -0400 (Thu, 15 May 2008) | 2 lines fix typos in whatsnew ........ r63348 | benjamin.peterson | 2008-05-15 22:24:49 -0400 (Thu, 15 May 2008) | 2 lines make test_platform a bit more assertive (We'll see what the buildbots say.) ........
Diffstat (limited to 'Lib')
-rw-r--r--Lib/bsddb/test/test_lock.py58
-rw-r--r--Lib/distutils/config.py2
-rw-r--r--Lib/test/test_enumerate.py16
-rw-r--r--Lib/test/test_generators.py11
-rw-r--r--Lib/test/test_genexps.py2
-rw-r--r--Lib/test/test_platform.py19
-rw-r--r--Lib/test/test_site.py7
-rw-r--r--Lib/test/test_warnings.py1
8 files changed, 94 insertions, 22 deletions
diff --git a/Lib/bsddb/test/test_lock.py b/Lib/bsddb/test/test_lock.py
index 973bc42..402d147 100644
--- a/Lib/bsddb/test/test_lock.py
+++ b/Lib/bsddb/test/test_lock.py
@@ -94,15 +94,55 @@ class LockingTestCase(unittest.TestCase):
for t in threads:
t.join()
- def test03_set_timeout(self):
- # test that the set_timeout call works
- if hasattr(self.env, 'set_timeout'):
- self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT)
- self.env.set_timeout(0, db.DB_SET_TXN_TIMEOUT)
- self.env.set_timeout(123456, db.DB_SET_LOCK_TIMEOUT)
- self.env.set_timeout(7890123, db.DB_SET_TXN_TIMEOUT)
-
- def theThread(self, sleepTime, lockType):
+ def _DISABLED_test03_lock_timeout(self):
+ # Disabled as this test crashes the python interpreter built in
+ # debug mode with:
+ # Fatal Python error: UNREF invalid object
+ # the error occurs as marked below.
+ self.env.set_timeout(0, db.DB_SET_LOCK_TIMEOUT)
+ self.env.set_timeout(0, db.DB_SET_TXN_TIMEOUT)
+ self.env.set_timeout(123456, db.DB_SET_LOCK_TIMEOUT)
+ self.env.set_timeout(7890123, db.DB_SET_TXN_TIMEOUT)
+
+ def deadlock_detection() :
+ while not deadlock_detection.end :
+ deadlock_detection.count = \
+ self.env.lock_detect(db.DB_LOCK_EXPIRE)
+ if deadlock_detection.count :
+ while not deadlock_detection.end :
+ pass
+ break
+ time.sleep(0.01)
+
+ deadlock_detection.end=False
+ deadlock_detection.count=0
+ t=Thread(target=deadlock_detection)
+ t.setDaemon(True)
+ t.start()
+ self.env.set_timeout(100000, db.DB_SET_LOCK_TIMEOUT)
+ anID = self.env.lock_id()
+ anID2 = self.env.lock_id()
+ self.assertNotEqual(anID, anID2)
+ lock = self.env.lock_get(anID, "shared lock", db.DB_LOCK_WRITE)
+ start_time=time.time()
+ # FIXME: I see the UNREF crash as the interpreter trys to exit
+ # from this call to lock_get.
+ self.assertRaises(db.DBLockNotGrantedError,
+ self.env.lock_get,anID2, "shared lock", db.DB_LOCK_READ)
+ end_time=time.time()
+ deadlock_detection.end=True
+ self.assertTrue((end_time-start_time) >= 0.1)
+ self.env.lock_put(lock)
+ t.join()
+
+ if db.version() >= (4,0):
+ self.env.lock_id_free(anID)
+ self.env.lock_id_free(anID2)
+
+ if db.version() >= (4,6):
+ self.assertTrue(deadlock_detection.count>0)
+
+ def theThread(self, lockType):
name = currentThread().getName()
if lockType == db.DB_LOCK_WRITE:
lt = "write"
diff --git a/Lib/distutils/config.py b/Lib/distutils/config.py
index a625aec..6ffccaa 100644
--- a/Lib/distutils/config.py
+++ b/Lib/distutils/config.py
@@ -7,7 +7,7 @@ import os
import sys
from configparser import ConfigParser
-from distutils.core import Command
+from distutils.cmd import Command
DEFAULT_PYPIRC = """\
[pypirc]
diff --git a/Lib/test/test_enumerate.py b/Lib/test/test_enumerate.py
index 08229bf..8cebf44 100644
--- a/Lib/test/test_enumerate.py
+++ b/Lib/test/test_enumerate.py
@@ -100,7 +100,8 @@ class EnumerateTestCase(unittest.TestCase):
def test_argumentcheck(self):
self.assertRaises(TypeError, self.enum) # no arguments
self.assertRaises(TypeError, self.enum, 1) # wrong type (not iterable)
- self.assertRaises(TypeError, self.enum, 'abc', 2) # too many arguments
+ self.assertRaises(TypeError, self.enum, 'abc', 'a') # wrong type
+ self.assertRaises(TypeError, self.enum, 'abc', 2, 3) # too many arguments
def test_tuple_reuse(self):
# Tests an implementation detail where tuple is reused
@@ -196,6 +197,19 @@ class TestReversed(unittest.TestCase):
self.assertEqual(rc, sys.getrefcount(r))
+class TestStart(EnumerateTestCase):
+
+ enum = lambda i: enumerate(i, start=11)
+ seq, res = 'abc', [(1, 'a'), (2, 'b'), (3, 'c')]
+
+
+class TestLongStart(EnumerateTestCase):
+
+ enum = lambda i: enumerate(i, start=sys.maxsize+1)
+ seq, res = 'abc', [(sys.maxsize+1,'a'), (sys.maxsize+2,'b'),
+ (sys.maxsize+3,'c')]
+
+
def test_main(verbose=None):
testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig,
TestReversed)
diff --git a/Lib/test/test_generators.py b/Lib/test/test_generators.py
index 992126f..e27eadd 100644
--- a/Lib/test/test_generators.py
+++ b/Lib/test/test_generators.py
@@ -917,6 +917,17 @@ StopIteration
>>> g.gi_code is f.__code__
True
+
+Test the __name__ attribute and the repr()
+
+>>> def f():
+... yield 5
+...
+>>> g = f()
+>>> g.__name__
+'f'
+>>> repr(g) # doctest: +ELLIPSIS
+'<f generator object at ...>'
"""
# conjoin is a simple backtracking generator, named in honor of Icon's
diff --git a/Lib/test/test_genexps.py b/Lib/test/test_genexps.py
index 46f7ab8..c8abbcc 100644
--- a/Lib/test/test_genexps.py
+++ b/Lib/test/test_genexps.py
@@ -92,7 +92,7 @@ Verify that parenthesis are required when used as a keyword argument value
Verify that parenthesis are required when used as a keyword argument value
>>> dict(a = (i for i in range(10))) #doctest: +ELLIPSIS
- {'a': <generator object at ...>}
+ {'a': <<genexpr> generator object at ...>}
Verify early binding for the outermost for-expression
diff --git a/Lib/test/test_platform.py b/Lib/test/test_platform.py
index 22307cd..fced4d0 100644
--- a/Lib/test/test_platform.py
+++ b/Lib/test/test_platform.py
@@ -1,7 +1,9 @@
+import sys
import unittest
-from test import test_support
import platform
+from test import test_support
+
class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
@@ -49,26 +51,35 @@ class PlatformTest(unittest.TestCase):
def test_uname(self):
res = platform.uname()
+ self.assert_(any(res))
def test_java_ver(self):
res = platform.java_ver()
+ if sys.platform == 'java':
+ self.assert_(all(res))
def test_win32_ver(self):
res = platform.win32_ver()
def test_mac_ver(self):
res = platform.mac_ver()
+ try:
+ import gestalt
+ except ImportError: pass
+ else:
+ if sys.platform == 'darwin':
+ self.assert_(all(res))
def test_dist(self):
res = platform.dist()
def test_libc_ver(self):
- from sys import executable
import os
- if os.path.isdir(executable) and os.path.exists(executable+'.exe'):
+ if os.path.isdir(sys.executable) and \
+ os.path.exists(sys.executable+'.exe'):
# Cygwin horror
executable = executable + '.exe'
- res = platform.libc_ver(executable)
+ res = platform.libc_ver(sys.executable)
def test_main():
test_support.run_unittest(
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 329df4b..a13751c 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -36,7 +36,7 @@ class HelperFunctionsTests(unittest.TestCase):
"""Save a copy of sys.path"""
self.sys_path = sys.path[:]
-
+ def tearDown(self):
"""Restore sys.path"""
sys.path = self.sys_path
@@ -256,13 +256,8 @@ class ImportSideEffectTests(unittest.TestCase):
else:
self.fail("sitecustomize not imported automatically")
-
-
-
def test_main():
run_unittest(HelperFunctionsTests, ImportSideEffectTests)
-
-
if __name__ == "__main__":
test_main()
diff --git a/Lib/test/test_warnings.py b/Lib/test/test_warnings.py
index fa2297c..7b512ef 100644
--- a/Lib/test/test_warnings.py
+++ b/Lib/test/test_warnings.py
@@ -396,6 +396,7 @@ class _WarningsTests(BaseTest):
self.assertRaises(TypeError, self.module.warn, "Warning!")
finally:
self.module.showwarning = old_showwarning
+ self.module.resetwarnings()
def test_show_warning_output(self):
# With showarning() missing, make sure that output is okay.