Commit fe554734 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Imported Upstream version 1.2.1

parent 95eb8bbe
Changes between 1.2.1 and 1.2.0
=====================================
- refined usage and options for "py.cleanup"::
py.cleanup # remove "*.pyc" and "*$py.class" (jython) files
py.cleanup -e .swp -e .cache # also remove files with these extensions
py.cleanup -s # remove "build" and "dist" directory next to setup.py files
py.cleanup -d # also remove empty directories
py.cleanup -a # synonym for "-s -d -e 'pip-log.txt'"
py.cleanup -n # dry run, only show what would be removed
- add a new option "py.test --funcargs" which shows available funcargs
and their help strings (docstrings on their respective factory function)
for a given test path
- display a short and concise traceback if a funcarg lookup fails
- early-load "conftest.py" files in non-dot first-level sub directories.
allows to conveniently keep and access test-related options in a ``test``
subdir and still add command line options.
- fix issue67: new super-short traceback-printing option: "--tb=line" will print a single line for each failing (python) test indicating its filename, lineno and the failure value
- fix issue78: always call python-level teardown functions even if the
according setup failed. This includes refinements for calling setup_module/class functions
which will now only be called once instead of the previous behaviour where they'd be called
multiple times if they raise an exception (including a Skipped exception). Any exception
will be re-corded and associated with all tests in the according module/class scope.
- fix issue63: assume <40 columns to be a bogus terminal width, default to 80
- fix pdb debugging to be in the correct frame on raises-related errors
- update apipkg.py to fix an issue where recursive imports might
unnecessarily break importing
- fix plugin links
Changes between 1.2 and 1.1.1
=====================================
- moved dist/looponfailing from py.test core into a new
separately released pytest-xdist plugin.
- new junitxml plugin: --junitxml=path will generate a junit style xml file
which is processable e.g. by the Hudson CI system.
- new option: --genscript=path will generate a standalone py.test script
which will not need any libraries installed. thanks to Ralf Schmitt.
- new option: --ignore will prevent specified path from collection.
Can be specified multiple times.
- new option: --confcutdir=dir will make py.test only consider conftest
files that are relative to the specified dir.
- new funcarg: "pytestconfig" is the pytest config object for access
to command line args and can now be easily used in a test.
- install 'py.test' and `py.which` with a ``-$VERSION`` suffix to
disambiguate between Python3, python2.X, Jython and PyPy installed versions.
- new "pytestconfig" funcarg allows access to test config object
- new "pytest_report_header" hook can return additional lines
to be displayed at the header of a test run.
- (experimental) allow "py.test path::name1::name2::..." for pointing
to a test within a test collection directly. This might eventually
evolve as a full substitute to "-k" specifications.
- streamlined plugin loading: order is now as documented in
customize.html: setuptools, ENV, commandline, conftest.
also setuptools entry point names are turned to canonical namees ("pytest_*")
- automatically skip tests that need 'capfd' but have no os.dup
- allow pytest_generate_tests to be defined in classes as well
- deprecate usage of 'disabled' attribute in favour of pytestmark
- deprecate definition of Directory, Module, Class and Function nodes
in conftest.py files. Use pytest collect hooks instead.
- collection/item node specific runtest/collect hooks are only called exactly
on matching conftest.py files, i.e. ones which are exactly below
the filesystem path of an item
- change: the first pytest_collect_directory hook to return something
will now prevent further hooks to be called.
- change: figleaf plugin now requires --figleaf to run. Also
change its long command line options to be a bit shorter (see py.test -h).
- change: pytest doctest plugin is now enabled by default and has a
new option --doctest-glob to set a pattern for file matches.
- change: remove internal py._* helper vars, only keep py._pydir
- robustify capturing to survive if custom pytest_runtest_setup
code failed and prevented the capturing setup code from running.
- make py.test.* helpers provided by default plugins visible early -
works transparently both for pydoc and for interactive sessions
which will regularly see e.g. py.test.mark and py.test.importorskip.
- simplify internal plugin manager machinery
- simplify internal collection tree by introducing a RootCollector node
- fix assert reinterpreation that sees a call containing "keyword=..."
- fix issue66: invoke pytest_sessionstart and pytest_sessionfinish
hooks on slaves during dist-testing, report module/session teardown
hooks correctly.
- fix issue65: properly handle dist-testing if no
execnet/py lib installed remotely.
- skip some install-tests if no execnet is available
- fix docs, fix internal bin/ script generation
Changes between 1.1.1 and 1.1.0
=====================================
......
......@@ -8,11 +8,11 @@ graft doc
graft contrib
graft bin
graft testing
exclude *.orig
exclude *.rej
exclude .hginore
exclude *.pyc
recursive-exclude testing *.pyc *.orig *.rej *$py.class
prune .pyc
prune .svn
prune .hg
#exclude *.orig
#exclude *.rej
#exclude .hginore
#exclude *.pyc
#recursive-exclude testing *.pyc *.orig *.rej *$py.class
#prune .pyc
#prune .svn
#prune .hg
Metadata-Version: 1.0
Name: py
Version: 1.1.1
Version: 1.2.1
Summary: py.test and pylib: rapid testing and development utils.
Home-page: http://pylib.org
Author: holger krekel, Guido Wesdorp, Carl Friedrich Bolz, Armin Rigo, Maciej Fijalkowski & others
......@@ -17,11 +17,11 @@ Description:
Interpreters: Python versions 2.4 through to 3.1, Jython 2.5.1.
For questions please check out http://pylib.org/contact.html
.. _`py.test`: http://pylib.org/test.html
.. _`py.test`: http://pytest.org
.. _`py.path`: http://pylib.org/path.html
.. _`py.code`: http://pylib.org/code.html
(c) Holger Krekel and others, 2009
(c) Holger Krekel and others, 2004-2010
Platform: unix
Platform: linux
......
#!/usr/bin/env python
#
# find and import a version of 'py'
# find and import a version of 'py' that exists in a parent dir
# of the current working directory. fall back to import a
# globally available version
#
import sys
import os
......
import py
import sys
pytest_plugins = '_pytest doctest pytester'.split()
collect_ignore = ['build', 'doc/_build']
rsyncdirs = ['conftest.py', 'bin', 'py', 'doc', 'testing']
try:
import execnet
except ImportError:
pass
else:
rsyncdirs.append(str(py.path.local(execnet.__file__).dirpath()))
import py
def pytest_addoption(parser):
......@@ -17,51 +13,62 @@ def pytest_addoption(parser):
group.addoption('--sshhost',
action="store", dest="sshhost", default=None,
help=("ssh xspec for ssh functional tests. "))
group.addoption('--gx',
action="append", dest="gspecs", default=None,
help=("add a global test environment, XSpec-syntax. "))
group.addoption('--runslowtests',
action="store_true", dest="runslowtests", default=False,
help=("run slow tests"))
def pytest_funcarg__specssh(request):
return getspecssh(request.config)
def getgspecs(config=None):
if config is None:
config = py.test.config
return [execnet.XSpec(spec)
for spec in config.getvalueorskip("gspecs")]
def pytest_funcarg__sshhost(request):
val = request.config.getvalue("sshhost")
if val:
return val
py.test.skip("need --sshhost option")
def pytest_generate_tests(metafunc):
multi = getattr(metafunc.function, 'multi', None)
if multi is not None:
assert len(multi.kwargs) == 1
for name, l in multi.kwargs.items():
for val in l:
metafunc.addcall(funcargs={name: val})
elif 'anypython' in metafunc.funcargnames:
for name in ('python2.4', 'python2.5', 'python2.6',
'python2.7', 'python3.1', 'pypy-c', 'jython'):
metafunc.addcall(id=name, param=name)
# configuration information for tests
def getgspecs(config=None):
if config is None:
config = py.test.config
return [execnet.XSpec(spec)
for spec in config.getvalueorskip("gspecs")]
def getspecssh(config=None):
xspecs = getgspecs(config)
for spec in xspecs:
if spec.ssh:
if not py.path.local.sysfind("ssh"):
py.test.skip("command not found: ssh")
return spec
py.test.skip("need '--gx ssh=...'")
def getsocketspec(config=None):
xspecs = getgspecs(config)
for spec in xspecs:
if spec.socket:
return spec
py.test.skip("need '--gx socket=...'")
# XXX copied from execnet's conftest.py - needs to be merged
winpymap = {
'python2.7': r'C:\Python27\python.exe',
'python2.6': r'C:\Python26\python.exe',
'python2.5': r'C:\Python25\python.exe',
'python2.4': r'C:\Python24\python.exe',
'python3.1': r'C:\Python31\python.exe',
}
def getexecutable(name, cache={}):
try:
return cache[name]
except KeyError:
executable = py.path.local.sysfind(name)
if executable:
if name == "jython":
import subprocess
popen = subprocess.Popen([str(executable), "--version"],
universal_newlines=True, stderr=subprocess.PIPE)
out, err = popen.communicate()
if not err or "2.5" not in err:
executable = None
cache[name] = executable
return executable
def pytest_generate_tests(metafunc):
multi = getattr(metafunc.function, 'multi', None)
if multi is None:
return
assert len(multi.kwargs) == 1
for name, l in multi.kwargs.items():
for val in l:
metafunc.addcall(funcargs={name: val})
def pytest_funcarg__anypython(request):
name = request.param
executable = getexecutable(name)
if executable is None:
if sys.platform == "win32":
executable = winpymap.get(name, None)
if executable:
executable = py.path.local(executable)
if executable.check():
return executable
py.test.skip("no %s found" % (name,))
return executable
......@@ -14,6 +14,4 @@ def pytest(argv=None):
except SystemExit:
pass
# we need to reset the global py.test.config object
py._com.comregistry = py._com.comregistry.__class__([])
py.test.config = py.test.config.__class__(
pluginmanager=py.test._PluginManager(py._com.comregistry))
py.test.config = py.test.config.__class__()
......@@ -9,7 +9,7 @@
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.1.1.html">1.1.1 ANN</a></div></div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
......
......@@ -9,7 +9,7 @@
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.1.1.html">1.1.1 ANN</a></div></div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
......
......@@ -9,7 +9,7 @@
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.1.1.html">1.1.1 ANN</a></div></div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
......
......@@ -9,7 +9,7 @@
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.1.1.html">1.1.1 ANN</a></div></div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
......
......@@ -9,7 +9,7 @@
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.1.1.html">1.1.1 ANN</a></div></div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
......
......@@ -9,7 +9,7 @@
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.1.1.html">1.1.1 ANN</a></div></div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
......
......@@ -9,7 +9,7 @@
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.1.1.html">1.1.1 ANN</a></div></div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>release-1.2.0</title>
<meta content="text/html;charset=ISO-8859-1" name="Content-Type"/>
<link href="../style.css" media="screen" rel="stylesheet" type="text/css"/></head>
<body>
<div id="navspace">
<div><a href="http://pylib.org"><img alt="py lib" height="57" id="pyimg" src="http://codespeak.net/img/pylib.png" width="77"/></a></div>
<div id="menubar">
<div>
<div><a class="menu" href="release-1.2.1.html">1.2.1 ANN</a></div></div>
<div>
<div><a class="menu" href="../install.html">INSTALL</a></div></div>
<div>
<div><a class="menu" href="../contact.html">CONTACT</a></div></div>
<div>
<div><a class="menu" href="../changelog.html">CHANGELOG</a></div></div>
<div>
<div><a class="menu" href="../faq.html">FAQ</a></div></div>
<div>
<div>
<h3>py.test:</h3>
<div><a class="menu" href="../test/index.html">Index</a></div>
<div><a class="menu" href="../test/quickstart.html">Quickstart</a></div>
<div><a class="menu" href="../test/features.html">Features</a></div>
<div><a class="menu" href="../test/plugin/index.html">Plugins</a></div>
<div><a class="menu" href="../test/funcargs.html">Funcargs</a></div>
<div><a class="menu" href="../test/customize.html">Customize</a></div>
<div><a class="menu" href="../test/talks.html">Tutorials</a></div></div></div>
<div>
<div>
<h3>supporting APIs:</h3>
<div><a class="menu" href="../index.html">Index</a></div>
<div><a class="menu" href="../path.html">py.path</a></div>
<div><a class="menu" href="../code.html">py.code</a></div></div></div></div></div>
<div id="contentspace">
<div class="document" id="py-test-pylib-1-2-0-junitxml-standalone-test-scripts-pluginization">
<h1 class="title">py.test/pylib 1.2.0: junitxml, standalone test scripts, pluginization</h1>
<p>py.test is an advanced automated testing tool working with
Python2, Python3 and Jython versions on all major operating
systems. It has a simple plugin architecture and can run many
existing common Python test suites without modification. It offers
some unique features not found in other testing tools.
See <a class="reference external" href="http://pytest.org">http://pytest.org</a> for more info.</p>
<p>py.test 1.2.0 brings many bug fixes and interesting new abilities:</p>
<ul class="simple">
<li>--junitxml=path will create an XML file for use with CI processing</li>
<li>--genscript=path creates a standalone py.test-equivalent test-script</li>
<li>--ignore=path prevents collection of anything below that path</li>
<li>--confcutdir=path only lookup conftest.py test configs below that path</li>
<li>a 'pytest_report_header' hook to add info to the terminal report header</li>
<li>a 'pytestconfig' function argument gives direct access to option values</li>
<li>'pytest_generate_tests' can now be put into a class as well</li>
<li>on CPython py.test additionally installs as &quot;py.test-VERSION&quot;, on
Jython as py.test-jython and on PyPy as py.test-pypy-XYZ</li>
</ul>
<p>Apart from many bug fixes 1.2.0 also has better pluginization:
Distributed testing and looponfailing testing now live in the
separately installable 'pytest-xdist' plugin. The same is true for
'pytest-figleaf' for doing coverage reporting. Those two plugins
can serve well now as blue prints for doing your own.</p>
<p>thanks to all who helped and gave feedback,
have fun,</p>
<p>holger krekel, January 2010</p>
<div class="section" id="changes-between-1-2-0-and-1-1-1">
<h1>Changes between 1.2.0 and 1.1.1</h1>
<ul class="simple">
<li>moved dist/looponfailing from py.test core into a new
separately released pytest-xdist plugin.</li>
<li>new junitxml plugin: --junitxml=path will generate a junit style xml file
which is processable e.g. by the Hudson CI system.</li>
<li>new option: --genscript=path will generate a standalone py.test script
which will not need any libraries installed. thanks to Ralf Schmitt.</li>
<li>new option: --ignore will prevent specified path from collection.
Can be specified multiple times.</li>
<li>new option: --confcutdir=dir will make py.test only consider conftest
files that are relative to the specified dir.</li>
<li>new funcarg: &quot;pytestconfig&quot; is the pytest config object for access
to command line args and can now be easily used in a test.</li>
<li>install 'py.test' and <cite>py.which</cite> with a <tt class="docutils literal"><span class="pre">-$VERSION</span></tt> suffix to
disambiguate between Python3, python2.X, Jython and PyPy installed versions.</li>
<li>new &quot;pytestconfig&quot; funcarg allows access to test config object</li>
<li>new &quot;pytest_report_header&quot; hook can return additional lines
to be displayed at the header of a test run.</li>
<li>(experimental) allow &quot;py.test path::name1::name2::...&quot; for pointing
to a test within a test collection directly. This might eventually
evolve as a full substitute to &quot;-k&quot; specifications.</li>
<li>streamlined plugin loading: order is now as documented in
customize.html: setuptools, ENV, commandline, conftest.
also setuptools entry point names are turned to canonical namees (&quot;pytest_*&quot;)</li>
<li>automatically skip tests that need 'capfd' but have no os.dup</li>
<li>allow pytest_generate_tests to be defined in classes as well</li>
<li>deprecate usage of 'disabled' attribute in favour of pytestmark</li>
<li>deprecate definition of Directory, Module, Class and Function nodes
in conftest.py files. Use pytest collect hooks instead.</li>
<li>collection/item node specific runtest/collect hooks are only called exactly
on matching conftest.py files, i.e. ones which are exactly below
the filesystem path of an item</li>
<li>change: the first pytest_collect_directory hook to return something
will now prevent further hooks to be called.</li>
<li>change: figleaf plugin now requires --figleaf to run. Also
change its long command line options to be a bit shorter (see py.test -h).</li>
<li>change: pytest doctest plugin is now enabled by default and has a
new option --doctest-glob to set a pattern for file matches.</li>
<li>change: remove internal py._* helper vars, only keep py._pydir</li>
<li>robustify capturing to survive if custom pytest_runtest_setup
code failed and prevented the capturing setup code from running.</li>
<li>make py.test.* helpers provided by default plugins visible early -
works transparently both for pydoc and for interactive sessions
which will regularly see e.g. py.test.mark and py.test.importorskip.</li>
<li>simplify internal plugin manager machinery</li>
<li>simplify internal collection tree by introducing a RootCollector node</li>
<li>fix assert reinterpreation that sees a call containing &quot;keyword=...&quot;</li>
<li>fix issue66: invoke pytest_sessionstart and pytest_sessionfinish
hooks on slaves during dist-testing, report module/session teardown
hooks correctly.</li>
<li>fix issue65: properly handle dist-testing if no
execnet/py lib installed remotely.</li>
<li>skip some install-tests if no execnet is available</li>
<li>fix docs, fix internal bin/ script generation</li>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7597274-3");
pageTracker._trackPageview();
} catch(err) {}</script>
</body></html>
\ No newline at end of file
py.test/pylib 1.2.0: junitxml, standalone test scripts, pluginization
--------------------------------------------------------------------------------
py.test is an advanced automated testing tool working with
Python2, Python3 and Jython versions on all major operating
systems. It has a simple plugin architecture and can run many
existing common Python test suites without modification. It offers
some unique features not found in other testing tools.
See http://pytest.org for more info.
py.test 1.2.0 brings many bug fixes and interesting new abilities:
* --junitxml=path will create an XML file for use with CI processing
* --genscript=path creates a standalone py.test-equivalent test-script
* --ignore=path prevents collection of anything below that path
* --confcutdir=path only lookup conftest.py test configs below that path
* a 'pytest_report_header' hook to add info to the terminal report header
* a 'pytestconfig' function argument gives direct access to option values
* 'pytest_generate_tests' can now be put into a class as well
* on CPython py.test additionally installs as "py.test-VERSION", on
Jython as py.test-jython and on PyPy as py.test-pypy-XYZ
Apart from many bug fixes 1.2.0 also has better pluginization:
Distributed testing and looponfailing testing now live in the
separately installable 'pytest-xdist' plugin. The same is true for
'pytest-figleaf' for doing coverage reporting. Those two plugins
can serve well now as blue prints for doing your own.
thanks to all who helped and gave feedback,
have fun,
holger krekel, January 2010
Changes between 1.2.0 and 1.1.1
=====================================
- moved dist/looponfailing from py.test core into a new
separately released pytest-xdist plugin.
- new junitxml plugin: --junitxml=path will generate a junit style xml file
which is processable e.g. by the Hudson CI system.
- new option: --genscript=path will generate a standalone py.test script
which will not need any libraries installed. thanks to Ralf Schmitt.
- new option: --ignore will prevent specified path from collection.
Can be specified multiple times.
- new option: --confcutdir=dir will make py.test only consider conftest
files that are relative to the specified dir.
- new funcarg: "pytestconfig" is the pytest config object for access
to command line args and can now be easily used in a test.
- install 'py.test' and `py.which` with a ``-$VERSION`` suffix to
disambiguate between Python3, python2.X, Jython and PyPy installed versions.
- new "pytestconfig" funcarg allows access to test config object
- new "pytest_report_header" hook can return additional lines
to be displayed at the header of a test run.
- (experimental) allow "py.test path::name1::name2::..." for pointing
to a test within a test collection directly. This might eventually
evolve as a full substitute to "-k" specifications.
- streamlined plugin loading: order is now as documented in
customize.html: setuptools, ENV, commandline, conftest.
also setuptools entry point names are turned to canonical namees ("pytest_*")
- automatically skip tests that need 'capfd' but have no os.dup
- allow pytest_generate_tests to be defined in classes as well
- deprecate usage of 'disabled' attribute in favour of pytestmark
- deprecate definition of Directory, Module, Class and Function nodes
in conftest.py files. Use pytest collect hooks instead.
- collection/item node specific runtest/collect hooks are only called exactly
on matching conftest.py files, i.e. ones which are exactly below
the filesystem path of an item
- change: the first pytest_collect_directory hook to return something
will now prevent further hooks to be called.
- change: figleaf plugin now requires --figleaf to run. Also
change its long command line options to be a bit shorter (see py.test -h).
- change: pytest doctest plugin is now enabled by default and has a
new option --doctest-glob to set a pattern for file matches.
- change: remove internal py._* helper vars, only keep py._pydir
- robustify capturing to survive if custom pytest_runtest_setup
code failed and prevented the capturing setup code from running.
- make py.test.* helpers provided by default plugins visible early -
works transparently both for pydoc and for interactive sessions
which will regularly see e.g. py.test.mark and py.test.importorskip.
- simplify internal plugin manager machinery