summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-02-25 12:39:23 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-02-25 12:39:23 (GMT)
commit23daade028eca9287f7072a6af26871f99088fe9 (patch)
tree50ecab74c1f0d7235c31af2bef7756962f381d89 /Lib/test
parentecbac8f38f2900ccbcc1d6d1c38d8d2dc1055618 (diff)
downloadcpython-23daade028eca9287f7072a6af26871f99088fe9.zip
cpython-23daade028eca9287f7072a6af26871f99088fe9.tar.gz
cpython-23daade028eca9287f7072a6af26871f99088fe9.tar.bz2
Merged revisions 61038,61042-61045,61047,61049-61053,61055-61057 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r61049 | christian.heimes | 2008-02-24 13:26:16 +0100 (Sun, 24 Feb 2008) | 1 line Use PY_FORMAT_SIZE_T instead of z for string formatting. Thanks Neal. ........ r61051 | mark.dickinson | 2008-02-24 19:12:36 +0100 (Sun, 24 Feb 2008) | 2 lines Remove duplicate 'import re' in decimal.py ........ r61052 | neal.norwitz | 2008-02-24 19:47:03 +0100 (Sun, 24 Feb 2008) | 11 lines Create a db_home directory with a unique name so multiple users can run the test simultaneously. The simplest thing I found that worked on both Windows and Unix was to use the PID. It's unique so should be sufficient. This should prevent many of the spurious failures of the automated tests since they run as different users. Also cleanup the directory consistenly in the tearDown methods. It would be nice if someone ensured that the directories are always created with a consistent name. ........ r61057 | christian.heimes | 2008-02-24 23:48:05 +0100 (Sun, 24 Feb 2008) | 2 lines Added dependency rules for Objects/stringlib/*.h stringobject, unicodeobject and the two formatters are rebuild whenever a header files changes ........
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_bsddb3.py14
-rw-r--r--Lib/test/test_format.py3
-rw-r--r--Lib/test/test_support.py9
3 files changed, 23 insertions, 3 deletions
diff --git a/Lib/test/test_bsddb3.py b/Lib/test/test_bsddb3.py
index a88b113..1f58c12 100644
--- a/Lib/test/test_bsddb3.py
+++ b/Lib/test/test_bsddb3.py
@@ -2,11 +2,12 @@
"""
Run all test cases.
"""
+import os
import sys
+import tempfile
import time
import unittest
-import test.test_support
-from test.test_support import requires, run_unittest, unlink
+from test.test_support import requires, verbose, run_unittest, unlink, rmtree
# When running as a script instead of within the regrtest framework, skip the
# requires test, since it's obvious we want to run them.
@@ -88,6 +89,15 @@ def suite():
# For invocation through regrtest
def test_main():
run_unittest(suite())
+ db_home = os.path.join(tempfile.gettempdir(), 'db_home')
+ # The only reason to remove db_home is in case if there is an old
+ # one lying around. This might be by a different user, so just
+ # ignore errors. We should always make a unique name now.
+ try:
+ rmtree(db_home)
+ except:
+ pass
+ rmtree('db_home%d' % os.getpid())
# For invocation as a script
if __name__ == '__main__':
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 7070286..53e7d04 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -234,7 +234,8 @@ test_exc('abc %a', 1, ValueError,
test_exc(str(b'abc %\u3000', 'raw-unicode-escape'), 1, ValueError,
"unsupported format character '?' (0x3000) at index 5")
-test_exc('%d', '1', TypeError, "an integer is required")
+#test_exc('%d', '1', TypeError, "an integer is required")
+test_exc('%d', '1', TypeError, '%d format: a number is required, not str')
test_exc('%g', '1', TypeError, "a float is required")
test_exc('no format', '1', TypeError,
"not all arguments converted during string formatting")
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index ba36448..4bc6619 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -9,6 +9,7 @@ import socket
import sys
import os
import os.path
+import shutil
import warnings
import unittest
@@ -64,6 +65,14 @@ def unlink(filename):
except OSError:
pass
+def rmtree(path):
+ try:
+ shutil.rmtree(path)
+ except OSError as e:
+ # Unix returns ENOENT, Windows returns ESRCH.
+ if e.errno not in (errno.ENOENT, errno.ESRCH):
+ raise
+
def forget(modname):
'''"Forget" a module was ever imported by removing it from sys.modules and
deleting any .pyc and .pyo files.'''