some minor compatibility issues wrt to the just released python2.7

--HG--
branch : trunk
This commit is contained in:
holger krekel
2010-07-04 22:13:12 +02:00
parent 223a04be27
commit b28c439494
7 changed files with 25 additions and 15 deletions
+11 -4
View File
@@ -33,7 +33,7 @@ warning:
"""
import py
import os
import sys, os
def pytest_funcarg__recwarn(request):
"""Return a WarningsRecorder instance that provides these methods:
@@ -41,9 +41,16 @@ def pytest_funcarg__recwarn(request):
* ``pop(category=None)``: return last warning matching the category.
* ``clear()``: clear list of warnings
"""
warnings = WarningsRecorder()
request.addfinalizer(warnings.finalize)
return warnings
if sys.version_info >= (2,7):
import warnings
oldfilters = warnings.filters[:]
warnings.simplefilter('default')
def reset_filters():
warnings.filters[:] = oldfilters
request.addfinalizer(reset_filters)
wrec = WarningsRecorder()
request.addfinalizer(wrec.finalize)
return wrec
def pytest_namespace():
return {'deprecated_call': deprecated_call}