summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-24 17:32:58 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-24 17:32:58 (GMT)
commit27e024023cca704e44b0d5f577415d061f89f7d7 (patch)
treeb298346cd1cd3fb2911d356aa827b6be5454a4b6
parenta3c39c0f72122cfdf673f82f8fc0d574f3d81757 (diff)
downloadcpython-27e024023cca704e44b0d5f577415d061f89f7d7.zip
cpython-27e024023cca704e44b0d5f577415d061f89f7d7.tar.gz
cpython-27e024023cca704e44b0d5f577415d061f89f7d7.tar.bz2
Skip test_ascii_formatd if _ctypes is not available (BSD, ...).
Previous change was incomplete (r79334).
-rwxr-xr-xLib/test/regrtest.py2
-rw-r--r--Lib/test/test_ascii_formatd.py21
2 files changed, 9 insertions, 14 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index 6f08e80..ef809fd 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -1406,6 +1406,7 @@ _expectations = {
""",
'openbsd3':
"""
+ test_ascii_formatd
test_bsddb
test_bsddb3
test_ctypes
@@ -1424,6 +1425,7 @@ _expectations = {
""",
'netbsd3':
"""
+ test_ascii_formatd
test_bsddb
test_bsddb185
test_bsddb3
diff --git a/Lib/test/test_ascii_formatd.py b/Lib/test/test_ascii_formatd.py
index 6af6ca6..c4a616d 100644
--- a/Lib/test/test_ascii_formatd.py
+++ b/Lib/test/test_ascii_formatd.py
@@ -3,20 +3,18 @@
# Test that it works, and test that it's deprecated.
import unittest
-from test.test_support import (check_warnings, run_unittest,
- cpython_only, import_module)
+from test.test_support import check_warnings, run_unittest, import_module
+
+# Skip tests if _ctypes module does not exist
+import_module('_ctypes')
+
+from ctypes import pythonapi, create_string_buffer, sizeof, byref, c_double
+PyOS_ascii_formatd = pythonapi.PyOS_ascii_formatd
class FormatDeprecationTests(unittest.TestCase):
- @cpython_only
def test_format_deprecation(self):
- # skip if _ctypes is not available
- import_module('_ctypes')
- # delay importing ctypes until we know we're in CPython
- from ctypes import (pythonapi, create_string_buffer, sizeof, byref,
- c_double)
- PyOS_ascii_formatd = pythonapi.PyOS_ascii_formatd
buf = create_string_buffer(' ' * 100)
with check_warnings(('PyOS_ascii_formatd is deprecated',
@@ -29,12 +27,7 @@ class FormatDeprecationTests(unittest.TestCase):
class FormatTests(unittest.TestCase):
# ensure that, for the restricted set of format codes,
# %-formatting returns the same values os PyOS_ascii_formatd
- @cpython_only
def test_format(self):
- # delay importing ctypes until we know we're in CPython
- from ctypes import (pythonapi, create_string_buffer, sizeof, byref,
- c_double)
- PyOS_ascii_formatd = pythonapi.PyOS_ascii_formatd
buf = create_string_buffer(' ' * 100)
tests = [