bump version, some windows test fixes, prevent logging from raising exceptions at the end (finally), add py25 to tox.ini.

This commit is contained in:
holger krekel 2013-09-30 16:09:26 +02:00
parent de35b077a2
commit 2c7d00579b
7 changed files with 45 additions and 38 deletions

View File

@ -14,22 +14,23 @@ known incompatibilities:
- the pytest_plugin_unregister hook wasn't ever properly called
and there is no known implementation of the hook - so it got removed.
- pytest.fixture-decorated functions cannot be generators (i.e. use yield) anymore.
This change might be reversed in 2.4.1 if it causes unforeseen real-life issues.
However, you can always write and return an inner function/generator
and change the fixture consumer to iterate over the returned generator.
This change was done in lieu of the new ``pytest.yield_fixture`` decorator, see below.
- pytest.fixture-decorated functions cannot be generators (i.e. use
yield) anymore. This change might be reversed in 2.4.1 if it causes
unforeseen real-life issues. However, you can always write and return
an inner function/generator and change the fixture consumer to iterate
over the returned generator. This change was done in lieu of the new
``pytest.yield_fixture`` decorator, see below.
new features:
- experimentally introduce a new ``pytest.yield_fixture`` decorator which
accepts exactly the same parameters as pytest.fixture but mandates
a ``yield`` statement instead of a ``return statement`` from fixture functions.
This allows direct integration with "with-style" context managers
in fixture functions and generally avoids registering of finalization callbacks
in favour of treating the "after-yield" as teardown code.
Thanks Andreas Pelme, Vladimir Keleshev, Floris Bruynooghe, Ronny Pfannschmidt
and many others for discussions.
- experimentally introduce a new ``pytest.yield_fixture`` decorator
which accepts exactly the same parameters as pytest.fixture but
mandates a ``yield`` statement instead of a ``return statement`` from
fixture functions. This allows direct integration with "with-style"
context managers in fixture functions and generally avoids registering
of finalization callbacks in favour of treating the "after-yield" as
teardown code. Thanks Andreas Pelme, Vladimir Keleshev, Floris
Bruynooghe, Ronny Pfannschmidt and many others for discussions.
- allow boolean expression directly with skipif/xfail
if a "reason" is also specified. Rework skipping documentation
@ -37,11 +38,12 @@ new features:
when importing markers between modules. Specifying conditions
as strings will remain fully supported.
- reporting: color the last line red or green depending if failures/errors occured
or everything passed. thanks Christian Theunert.
- reporting: color the last line red or green depending if
failures/errors occured or everything passed. thanks Christian
Theunert.
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no "-s" needed
anymore), making ``pytest.set_trace()`` a mere shortcut.
- make "import pdb ; pdb.set_trace()" work natively wrt capturing (no
"-s" needed anymore), making ``pytest.set_trace()`` a mere shortcut.
- fix issue181: --pdb now also works on collect errors (and
on internal errors) . This was implemented by a slight internal
@ -59,13 +61,14 @@ new features:
will replace the "get" function of the "requests" module with ``myfunc``.
- fix issue322: tearDownClass is not run if setUpClass failed. Thanks
Mathieu Agopian for the initial fix. Also make all of pytest/nose finalizer
mimick the same generic behaviour: if a setupX exists and fails,
don't run teardownX. This internally introduces a new method "node.addfinalizer()"
helper which can only be called during the setup phase of a node.
Mathieu Agopian for the initial fix. Also make all of pytest/nose
finalizer mimick the same generic behaviour: if a setupX exists and
fails, don't run teardownX. This internally introduces a new method
"node.addfinalizer()" helper which can only be called during the setup
phase of a node.
- simplify pytest.mark.parametrize() signature: allow to pass a CSV-separated string
to specify argnames. For example:
- simplify pytest.mark.parametrize() signature: allow to pass a
CSV-separated string to specify argnames. For example:
``pytest.mark.parametrize("input,expected", [(1,2), (2,3)])``
works as well as the previous:
``pytest.mark.parametrize(("input", "expected"), ...)``.
@ -75,11 +78,12 @@ new features:
- integrate tab-completion on options through use of "argcomplete".
Thanks Anthon van der Neut for the PR.
- change option names to be hyphen-separated long options but keep the old spelling
backward compatible. py.test -h will only show the hyphenated version,
for example "--collect-only" but "--collectonly" will remain valid as well
(for backward-compat reasons). Many thanks to Anthon van der Neut for
the implementation and to Hynek Schlawack for pushing us.
- change option names to be hyphen-separated long options but keep the
old spelling backward compatible. py.test -h will only show the
hyphenated version, for example "--collect-only" but "--collectonly"
will remain valid as well (for backward-compat reasons). Many thanks to
Anthon van der Neut for the implementation and to Hynek Schlawack for
pushing us.
- fix issue 308 - allow to mark/xfail/skip individual parameter sets
when parametrizing. Thanks Brianna Laugher.
@ -141,7 +145,6 @@ Bug fixes:
- fix issue 306 - cleanup of -k/-m options to only match markers/test
names/keywords respectively. Thanks Wouter van Ackooy.
- improved doctest counting for doctests in python modules --
files without any doctest items will not show up anymore
and doctest examples are counted as separate test items.

View File

@ -1,2 +1,2 @@
#
__version__ = '2.4.0.dev13'
__version__ = '2.4.0.dev14'

View File

@ -29,6 +29,11 @@ def pytest_load_initial_conftests(early_config, parser, args, __multicall__):
except ValueError:
pass
early_config.pluginmanager.add_shutdown(teardown)
# make sure logging does not raise exceptions if it is imported
def silence_logging_at_shutdown():
if "logging" in sys.modules:
sys.modules["logging"].raiseExceptions = False
early_config.pluginmanager.add_shutdown(silence_logging_at_shutdown)
# finally trigger conftest loading but while capturing (issue93)
capman.resumecapture()

View File

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

View File

@ -586,9 +586,9 @@ class TestDurationWithFixture:
result = testdir.runpytest("--durations=10")
assert result.ret == 0
result.stdout.fnmatch_lines([
"*durations*",
"* setup *test_1*",
"* call *test_1*",
])
result.stdout.fnmatch_lines_random("""
*durations*
* setup *test_1*
* call *test_1*
""")

View File

@ -437,7 +437,6 @@ class TestCaptureFixture:
])
assert result.ret == 2
@pytest.mark.xfail("sys.version_info < (2,7)")
@pytest.mark.issue14
def test_capture_and_logging(self, testdir):
p = testdir.makepyfile("""

View File

@ -1,6 +1,6 @@
[tox]
distshare={homedir}/.tox/distshare
envlist=py26,py27,py27-nobyte,py32,py33,py27-xdist,trial
envlist=py25,py26,py27,py27-nobyte,py32,py33,py27-xdist,trial
[testenv]
changedir=testing