fixes for python 2.4

--HG--
branch : 1.0.x
This commit is contained in:
holger krekel
2009-07-31 15:35:22 +02:00
parent 5156216871
commit e80714d701
4 changed files with 25 additions and 26 deletions

View File

@@ -542,7 +542,7 @@ class SetupBuilder:
try:
args = ['python', str(self.setup_path), 'sdist',
'--dist-dir', str(temp)]
subprocess.check_call(args)
subcall(args)
l = temp.listdir('py-*')
assert len(l) == 1
sdist = l[0]
@@ -557,6 +557,11 @@ class SetupBuilder:
finally:
temp.remove()
def subcall(args):
if hasattr(subprocess, 'check_call'):
subprocess.check_call(args)
else:
subprocess.call(args)
# code taken from Ronny Pfannenschmidt's virtualenvmanager
class VirtualEnv(object):
@@ -578,7 +583,7 @@ class VirtualEnv(object):
args = ['virtualenv', self.path]
if not sitepackages:
args.append('--no-site-packages')
subprocess.check_call(args)
subcall(args)
def makegateway(self):
python = self._cmd('python')

View File

@@ -105,12 +105,14 @@ class ReSTSyntaxTest(py.test.collect.Item):
def register_pygments(self):
# taken from pygments-main/external/rst-directive.py
from docutils.parsers.rst import directives
try:
from pygments.formatters import HtmlFormatter
except ImportError:
def pygments_directive(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return []
pygments_directive.options = {}
else:
# The default formatter
DEFAULT = HtmlFormatter(noclasses=True)
@@ -120,7 +122,6 @@ class ReSTSyntaxTest(py.test.collect.Item):
}
from docutils import nodes
from docutils.parsers.rst import directives
from pygments import highlight
from pygments.lexers import get_lexer_by_name, TextLexer
@@ -137,10 +138,10 @@ class ReSTSyntaxTest(py.test.collect.Item):
parsed = highlight(u'\n'.join(content), lexer, formatter)
return [nodes.raw('', parsed, format='html')]
pygments_directive.options = dict([(key, directives.flag) for key in VARIANTS])
pygments_directive.arguments = (1, 0, 1)
pygments_directive.content = 1
pygments_directive.options = dict([(key, directives.flag) for key in VARIANTS])
directives.register_directive('sourcecode', pygments_directive)
def resolve_linkrole(self, name, text, check=True):

View File

@@ -20,18 +20,11 @@ def pytest_configure(config):
config._setupstate = SetupState()
def pytest_sessionfinish(session, exitstatus):
# XXX see above
if hasattr(session.config, '_setupstate'):
hook = session.config.hook
rep = hook.pytest__teardown_final(session=session)
if rep:
hook.pytest__teardown_final_logerror(rep=rep)
# prevent logging module atexit handler from choking on
# its attempt to close already closed streams
# see http://bugs.python.org/issue6333
mod = py.std.sys.modules.get("logging", None)
if mod is not None:
mod.raiseExceptions = False
def pytest_make_collect_report(collector):
result = excinfo = None