summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxi <xi@18f92427-320e-0410-9341-c67f048884a3>2008-12-28 21:42:35 +0000
committerxi <xi@18f92427-320e-0410-9341-c67f048884a3>2008-12-28 21:42:35 +0000
commitfc66a58708104faf2d4ed7fa667831063911de60 (patch)
treeeb3a7f48ad0d4a5f8eee1af04728fa1af30fd6b9
parent3d554c8abd6c7990948d13b110ac732cfb3d68c9 (diff)
downloadpyyaml-fc66a58708104faf2d4ed7fa667831063911de60.tar.gz
Minor 2.3 and win32 compatibility fixes; clarify the 'feature not found' message in setup.py.
git-svn-id: http://svn.pyyaml.org/pyyaml/trunk@325 18f92427-320e-0410-9341-c67f048884a3
-rw-r--r--setup.py3
-rw-r--r--tests/test_appliance.py14
-rw-r--r--tests/test_constructor.py2
-rw-r--r--tests/test_recursive.py4
-rw-r--r--tests/test_yaml_ext.py10
5 files changed, 22 insertions, 11 deletions
diff --git a/setup.py b/setup.py
index 13fc574..01f2f56 100644
--- a/setup.py
+++ b/setup.py
@@ -220,7 +220,8 @@ class build_ext(_build_ext):
extra_postargs=(ext.extra_compile_args or []),
depends=ext.depends)
except CompileError:
- log.warn("%s appears not to be installed" % ext.feature_name)
+ log.warn("%s appears not to be installed: forcing --%s"
+ % (ext.feature_name, ext.neg_option_name))
log.warn("(if %s is installed, you may need to specify"
% ext.feature_name)
log.warn(" the option --include-dirs or uncomment and modify")
diff --git a/tests/test_appliance.py b/tests/test_appliance.py
index 09c46c9..49783ef 100644
--- a/tests/test_appliance.py
+++ b/tests/test_appliance.py
@@ -51,9 +51,13 @@ def parse_arguments(args):
return include_functions, include_filenames, verbose
def execute(function, filenames, verbose):
+ if hasattr(function, 'unittest_name'):
+ name = function.unittest_name
+ else:
+ name = function.func_name
if verbose:
sys.stdout.write('='*75+'\n')
- sys.stdout.write('%s(%s)...\n' % (function.func_name, ', '.join(filenames)))
+ sys.stdout.write('%s(%s)...\n' % (name, ', '.join(filenames)))
try:
function(verbose=verbose, *filenames)
except Exception, exc:
@@ -73,7 +77,7 @@ def execute(function, filenames, verbose):
if not verbose:
sys.stdout.write('.')
sys.stdout.flush()
- return (function, filenames, kind, info)
+ return (name, filenames, kind, info)
def display(results, verbose):
if results and not verbose:
@@ -81,7 +85,7 @@ def display(results, verbose):
total = len(results)
failures = 0
errors = 0
- for function, filenames, kind, info in results:
+ for name, filenames, kind, info in results:
if kind == 'SUCCESS':
continue
if kind == 'FAILURE':
@@ -89,7 +93,7 @@ def display(results, verbose):
if kind == 'ERROR':
errors += 1
sys.stdout.write('='*75+'\n')
- sys.stdout.write('%s(%s): %s\n' % (function.func_name, ', '.join(filenames), kind))
+ sys.stdout.write('%s(%s): %s\n' % (name, ', '.join(filenames), kind))
if kind == 'ERROR':
traceback.print_exception(file=sys.stdout, *info)
else:
@@ -98,7 +102,7 @@ def display(results, verbose):
sys.stdout.write('%s: see below\n' % info[0].__name__)
sys.stdout.write('~'*75+'\n')
for arg in info[1].args:
- pprint.pprint(arg, stream=sys.stdout, indent=2)
+ pprint.pprint(arg, stream=sys.stdout)
for filename in filenames:
sys.stdout.write('-'*75+'\n')
sys.stdout.write('%s:\n' % filename)
diff --git a/tests/test_constructor.py b/tests/test_constructor.py
index bb01692..0aacf17 100644
--- a/tests/test_constructor.py
+++ b/tests/test_constructor.py
@@ -231,6 +231,8 @@ def _serialize_value(data):
return repr(data.utctimetuple())
elif isinstance(data, unicode):
return data.encode('utf-8')
+ elif isinstance(data, float) and data != data:
+ return '?'
else:
return str(data)
diff --git a/tests/test_recursive.py b/tests/test_recursive.py
index b2dca3c..6707fd4 100644
--- a/tests/test_recursive.py
+++ b/tests/test_recursive.py
@@ -35,8 +35,8 @@ def test_recursive(recursive_filename, verbose=False):
assert output1 == output2, (output1, output2)
finally:
if verbose:
- print "VALUE1:", value1
- print "VALUE2:", value2
+ #print "VALUE1:", value1
+ #print "VALUE2:", value2
print "OUTPUT1:"
print output1
print "OUTPUT2:"
diff --git a/tests/test_yaml_ext.py b/tests/test_yaml_ext.py
index 8840ffd..e18becf 100644
--- a/tests/test_yaml_ext.py
+++ b/tests/test_yaml_ext.py
@@ -240,7 +240,11 @@ def wrap_ext_function(function):
function(*args, **kwds)
finally:
_tear_down()
- wrapper.func_name = '%s_ext' % function.func_name
+ try:
+ wrapper.func_name = '%s_ext' % function.func_name
+ except TypeError:
+ pass
+ wrapper.unittest_name = '%s_ext' % function.func_name
wrapper.unittest = function.unittest
wrapper.skip = getattr(function, 'skip', [])+['.skip-ext']
return wrapper
@@ -259,8 +263,8 @@ def wrap_ext(collections):
if isinstance(value, types.FunctionType) and hasattr(value, 'unittest'):
functions.append(wrap_ext_function(value))
for function in functions:
- assert function.func_name not in globals()
- globals()[function.func_name] = function
+ assert function.unittest_name not in globals()
+ globals()[function.unittest_name] = function
import test_tokens, test_structure, test_errors, test_resolver, test_constructor, \
test_emitter, test_representer, test_recursive