Minor 2.3 and win32 compatibility fixes; clarify the 'feature not found' message in setup.py.

This commit is contained in:
Kirill Simonov 2008-12-28 21:42:35 +00:00
parent 1e842301f4
commit 8e88d11b41
5 changed files with 22 additions and 11 deletions

View File

@ -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")

View File

@ -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)

View File

@ -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)

View File

@ -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:"

View File

@ -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