fixing docs, adding newest ez_setup.py, fixing a few win32 failures, fixing iocapture plugin

--HG--
branch : trunk
This commit is contained in:
holger krekel 2009-06-18 19:02:59 +02:00
parent 964ecbdb19
commit 82d40724fa
6 changed files with 27 additions and 13 deletions

View File

@ -5,7 +5,7 @@ Downloading
"easy_install py" "easy_install py"
=================================================== ===================================================
With a working `setuptools installation`_ you can install from the command line:: If you have a working `setuptools installation`_ you can install from the command line::
easy_install -U py easy_install -U py

View File

@ -89,11 +89,11 @@ Available py.test hooks
py.test calls hooks functions to implement its `test collection`_, running and py.test calls hooks functions to implement its `test collection`_, running and
reporting process. Upon loading of a plugin py.test performs reporting process. Upon loading of a plugin py.test performs
strict checking on contained hook functions. Function and argument names strict checking on contained hook functions. Function and argument names
need to match exactly the `original definition of the hook`_. It thus need to match exactly one of `hook definition specification`_. It thus
provides useful error reporting on mistyped hook or argument names provides useful error reporting on mistyped hook or argument names
and minimizes version incompatibilites. and minimizes version incompatibilites.
.. _`original definition of the hook`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/hookspec.py .. _`hook definition specification`: http://bitbucket.org/hpk42/py-trunk/src/tip/py/test/plugin/hookspec.py
.. _`configuration hooks`: .. _`configuration hooks`:

View File

@ -14,7 +14,7 @@ the appropriate options to ``use_setuptools()``.
This file can also be run as a script to install or upgrade setuptools. This file can also be run as a script to install or upgrade setuptools.
""" """
import sys import sys
DEFAULT_VERSION = "0.6c8" DEFAULT_VERSION = "0.6c9"
DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3] DEFAULT_URL = "http://pypi.python.org/packages/%s/s/setuptools/" % sys.version[:3]
md5_data = { md5_data = {
@ -48,13 +48,18 @@ md5_data = {
'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902', 'setuptools-0.6c8-py2.3.egg': '50759d29b349db8cfd807ba8303f1902',
'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de', 'setuptools-0.6c8-py2.4.egg': 'cba38d74f7d483c06e9daa6070cce6de',
'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b', 'setuptools-0.6c8-py2.5.egg': '1721747ee329dc150590a58b3e1ac95b',
'setuptools-0.6c9-py2.3.egg': 'a83c4020414807b496e4cfbe08507c03',
'setuptools-0.6c9-py2.4.egg': '260a2be2e5388d66bdaee06abec6342a',
'setuptools-0.6c9-py2.5.egg': 'fe67c3e5a17b12c0e7c541b7ea43a8e6',
'setuptools-0.6c9-py2.6.egg': 'ca37b1ff16fa2ede6e19383e7b59245a',
} }
import sys, os import sys, os
try: from hashlib import md5
except ImportError: from md5 import md5
def _validate_md5(egg_name, data): def _validate_md5(egg_name, data):
if egg_name in md5_data: if egg_name in md5_data:
from md5 import md5
digest = md5(data).hexdigest() digest = md5(data).hexdigest()
if digest != md5_data[egg_name]: if digest != md5_data[egg_name]:
print >>sys.stderr, ( print >>sys.stderr, (
@ -64,7 +69,6 @@ def _validate_md5(egg_name, data):
sys.exit(2) sys.exit(2)
return data return data
def use_setuptools( def use_setuptools(
version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir,
download_delay=15 download_delay=15
@ -233,7 +237,6 @@ def update_md5(filenames):
"""Update our built-in md5 registry""" """Update our built-in md5 registry"""
import re import re
from md5 import md5
for name in filenames: for name in filenames:
base = os.path.basename(name) base = os.path.basename(name)
@ -270,3 +273,4 @@ if __name__=='__main__':

View File

@ -4,7 +4,7 @@ from py.__.test.dist.nodemanage import NodeManager
class pytest_funcarg__mysetup: class pytest_funcarg__mysetup:
def __init__(self, request): def __init__(self, request):
basetemp = request.config.mktemp( basetemp = request.config.mktemp(
"mysetup:%s" % request.function.__name__, "mysetup-%s" % request.function.__name__,
numbered=True) numbered=True)
self.source = basetemp.mkdir("source") self.source = basetemp.mkdir("source")
self.dest = basetemp.mkdir("dest") self.dest = basetemp.mkdir("dest")

View File

@ -23,9 +23,10 @@ def pytest_funcarg__capfd(request):
return capture return capture
def pytest_pyfunc_call(pyfuncitem): def pytest_pyfunc_call(pyfuncitem):
for funcarg, value in pyfuncitem.funcargs.items(): if hasattr(pyfuncitem, 'funcargs'):
if funcarg == "capsys" or funcarg == "capfd": for funcarg, value in pyfuncitem.funcargs.items():
value.reset() if funcarg == "capsys" or funcarg == "capfd":
value.reset()
class Capture: class Capture:
_capture = None _capture = None
@ -62,3 +63,11 @@ class TestCapture:
assert out.startswith("42") assert out.startswith("42")
""") """)
reprec.assertoutcome(passed=1) reprec.assertoutcome(passed=1)
def test_funcall_yielded_no_funcargs(self, testdir):
reprec = testdir.inline_runsource("""
def test_hello():
yield lambda: None
""")
reprec.assertoutcome(passed=1)

View File

@ -3,7 +3,7 @@ funcargs and support code for testing py.test functionality.
""" """
import py import py
import os import sys, os
import inspect import inspect
from py.__.test.config import Config as pytestConfig from py.__.test.config import Config as pytestConfig
import hookspec import hookspec
@ -271,7 +271,8 @@ class TmpTestdir:
print "running", cmdargs, "curdir=", py.path.local() print "running", cmdargs, "curdir=", py.path.local()
f1 = p1.open("w") f1 = p1.open("w")
f2 = p2.open("w") f2 = p2.open("w")
popen = self.popen(cmdargs, stdout=f1, stderr=f2, close_fds=True) popen = self.popen(cmdargs, stdout=f1, stderr=f2,
close_fds=(sys.platform != "win32"))
ret = popen.wait() ret = popen.wait()
f1.close() f1.close()
f2.close() f2.close()