some fixes to make cross linux/windows remote testing work again

This commit is contained in:
holger krekel 2010-11-13 19:46:28 +01:00
parent 868848a9a6
commit 1bc444d5c8
5 changed files with 18 additions and 10 deletions

View File

@ -157,14 +157,17 @@ class PluginManager(object):
def consider_setuptools_entrypoints(self): def consider_setuptools_entrypoints(self):
try: try:
from pkg_resources import iter_entry_points from pkg_resources import iter_entry_points, DistributionNotFound
except ImportError: except ImportError:
return # XXX issue a warning return # XXX issue a warning
for ep in iter_entry_points('pytest11'): for ep in iter_entry_points('pytest11'):
name = canonical_importname(ep.name) name = canonical_importname(ep.name)
if name in self._name2plugin: if name in self._name2plugin:
continue continue
plugin = ep.load() try:
plugin = ep.load()
except DistributionNotFound:
continue
self.register(plugin, name=name) self.register(plugin, name=name)
def consider_preparse(self, args): def consider_preparse(self, args):

View File

@ -400,10 +400,8 @@ class TmpTestdir:
return colitem return colitem
def popen(self, cmdargs, stdout, stderr, **kw): def popen(self, cmdargs, stdout, stderr, **kw):
if not hasattr(py.std, 'subprocess'):
py.test.skip("no subprocess module")
env = os.environ.copy() env = os.environ.copy()
env['PYTHONPATH'] = ":".join(filter(None, [ env['PYTHONPATH'] = os.pathsep.join(filter(None, [
str(os.getcwd()), env.get('PYTHONPATH', '')])) str(os.getcwd()), env.get('PYTHONPATH', '')]))
kw['env'] = env kw['env'] = env
#print "env", env #print "env", env
@ -449,12 +447,13 @@ class TmpTestdir:
def _getpybinargs(self, scriptname): def _getpybinargs(self, scriptname):
if not self.request.config.getvalue("notoolsonpath"): if not self.request.config.getvalue("notoolsonpath"):
script = py.path.local.sysfind(scriptname) import pytest
script = pytest.__file__.strip("co")
assert script, "script %r not found" % scriptname assert script, "script %r not found" % scriptname
# XXX we rely on script refering to the correct environment # XXX we rely on script refering to the correct environment
# we cannot use "(py.std.sys.executable,script)" # we cannot use "(py.std.sys.executable,script)"
# becaue on windows the script is e.g. a py.test.exe # becaue on windows the script is e.g. a py.test.exe
return (script,) return (py.std.sys.executable, script,)
else: else:
py.test.skip("cannot run %r with --no-tools-on-path" % scriptname) py.test.skip("cannot run %r with --no-tools-on-path" % scriptname)

View File

@ -5,7 +5,7 @@ see http://pytest.org for documentation and details
(c) Holger Krekel and others, 2004-2010 (c) Holger Krekel and others, 2004-2010
""" """
__version__ = '2.0.0.dev26' __version__ = '2.0.0.dev27'
__all__ = ['main'] __all__ = ['main']
from _pytest.core import main, UsageError, _preloadplugins from _pytest.core import main, UsageError, _preloadplugins

View File

@ -22,7 +22,7 @@ def main():
name='pytest', name='pytest',
description='py.test: simple powerful testing with Python', description='py.test: simple powerful testing with Python',
long_description = long_description, long_description = long_description,
version='2.0.0.dev26', version='2.0.0.dev27',
url='http://pytest.org', url='http://pytest.org',
license='MIT license', license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],

View File

@ -36,6 +36,12 @@ commands=
[testenv:py31] [testenv:py31]
deps=pylib deps=pylib
[testenv:py31-xdist]
deps=pytest-xdist
commands=
py.test -n3 -rfsxX \
--junitxml={envlogdir}/junit-{envname}.xml []
[testenv:py32] [testenv:py32]
deps=pylib deps=pylib
@ -52,5 +58,5 @@ commands=
minversion=2.0 minversion=2.0
plugins=pytester plugins=pytester
addopts=-rfx --pyargs addopts=-rfx --pyargs
rsyncdirs=pytest.py _pytest testing rsyncdirs=tox.ini pytest.py _pytest testing