fix python3 issues, add missing plugin docs

--HG--
branch : trunk
This commit is contained in:
holger krekel 2010-01-03 13:27:06 +01:00
parent d541713dca
commit 27aa14c20f
6 changed files with 68 additions and 6 deletions

View File

@ -0,0 +1,29 @@
pytest_genscript plugin
=======================
generate standalone test script to be distributed along with an application.
.. contents::
:local:
command line options
--------------------
``--genscript=path``
create standalone py.test script at given target path.
Start improving this plugin in 30 seconds
=========================================
1. Download `pytest_genscript.py`_ plugin source code
2. put it somewhere as ``pytest_genscript.py`` into your import path
3. a subsequent ``py.test`` run will use your local version
Checkout customize_, other plugins_ or `get in contact`_.
.. include:: links.txt

View File

@ -0,0 +1,29 @@
pytest_logxml plugin
====================
logging of test results in JUnit-XML format, for use with Hudson
.. contents::
:local:
and build integration servers. Based on initial code from Ross Lawley.
command line options
--------------------
``--xml=path``
create junit-xml style report file at the given path.
Start improving this plugin in 30 seconds
=========================================
1. Download `pytest_logxml.py`_ plugin source code
2. put it somewhere as ``pytest_logxml.py`` into your import path
3. a subsequent ``py.test`` run will use your local version
Checkout customize_, other plugins_ or `get in contact`_.
.. include:: links.txt

View File

@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
""" """
py.test and pylib: rapid testing and development utils py.test and pylib: rapid testing and development utils

View File

@ -44,16 +44,17 @@ def main(pybasedir, outfile, infile):
name2src = {} name2src = {}
for f in files: for f in files:
k = f.replace(os.sep, ".")[:-3] k = f.replace(os.sep, ".")[:-3]
name2src[k] = open(f, "rb").read() name2src[k] = open(f, "r").read()
data = pickle.dumps(name2src, 2) data = pickle.dumps(name2src, 2)
data = zlib.compress(data, 9) data = zlib.compress(data, 9)
data = base64.encodestring(data) data = base64.encodestring(data)
data = data.decode("ascii")
exe = open(infile, "rb").read() exe = open(infile, "r").read()
exe = exe.replace("@SOURCES@", data) exe = exe.replace("@SOURCES@", data)
open(outfile, "wb").write(exe) open(outfile, "w").write(exe)
os.chmod(outfile, 493) # 0755 os.chmod(outfile, 493) # 0755
sys.stdout.write("generated standalone py.test at %r, have fun!\n" % outfile) sys.stdout.write("generated standalone py.test at %r, have fun!\n" % outfile)

View File

@ -17,7 +17,7 @@ def pytest_funcarg__repowc1(request):
) )
for x in ('test_remove', 'test_move', 'test_status_deleted'): for x in ('test_remove', 'test_move', 'test_status_deleted'):
if request.function.__name__.startswith(x): if request.function.__name__.startswith(x):
print >>sys.stderr, ("saving repo", repo, "for", request.function) #print >>sys.stderr, ("saving repo", repo, "for", request.function)
_savedrepowc = save_repowc(repo, wc) _savedrepowc = save_repowc(repo, wc)
request.addfinalizer(lambda: restore_repowc(_savedrepowc)) request.addfinalizer(lambda: restore_repowc(_savedrepowc))
return repo, repourl, wc return repo, repourl, wc
@ -67,7 +67,7 @@ def save_repowc(repo, wc):
def restore_repowc(obj): def restore_repowc(obj):
savedrepo, savedwc = obj savedrepo, savedwc = obj
print >>sys.stderr, ("restoring", savedrepo) #print >>sys.stderr, ("restoring", savedrepo)
repo = savedrepo.new(basename=savedrepo.basename[:-2]) repo = savedrepo.new(basename=savedrepo.basename[:-2])
assert repo.check() assert repo.check()
wc = savedwc.new(basename=savedwc.basename[:-2]) wc = savedwc.new(basename=savedwc.basename[:-2])

View File

@ -1,3 +1,4 @@
import py
from py.plugin.pytest_restdoc import deindent from py.plugin.pytest_restdoc import deindent
def test_deindent(): def test_deindent():
@ -9,6 +10,9 @@ def test_deindent():
assert deindent(' foo\n bar\n') == ' foo\nbar\n' assert deindent(' foo\n bar\n') == ' foo\nbar\n'
class TestDoctest: class TestDoctest:
def setup_class(cls):
py.test.importorskip("docutils")
def pytest_funcarg__testdir(self, request): def pytest_funcarg__testdir(self, request):
testdir = request.getfuncargvalue("testdir") testdir = request.getfuncargvalue("testdir")
testdir.plugins.append("restdoc") testdir.plugins.append("restdoc")