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

View File

@ -11,7 +11,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.4.0.dev13', version='2.4.0.dev14',
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

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

View File

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

View File

@ -1,6 +1,6 @@
[tox] [tox]
distshare={homedir}/.tox/distshare 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] [testenv]
changedir=testing changedir=testing