merge heads

This commit is contained in:
holger krekel 2011-07-12 17:21:48 +02:00
commit 46b1348b79
9 changed files with 22 additions and 6 deletions

View File

@ -1,3 +1,8 @@
Changes between 2.1.0 and 2.1.1.DEV
----------------------------------------------
- XXX
Changes between 2.0.3 and 2.1.0.DEV
----------------------------------------------

View File

@ -1,2 +1,2 @@
#
__version__ = '2.1.0'
__version__ = '2.1.1.dev1'

View File

@ -53,7 +53,7 @@ def interpret(source, frame, should_fail=False):
if should_fail:
return ("(assertion failed, but when it was re-run for "
"printing intermediate values, it did not fail. Suggestions: "
"compute assert expression before the assert or use --no-assert)")
"compute assert expression before the assert or use --assert=plain)")
def run(offending_line, frame=None):
if frame is None:

View File

@ -482,7 +482,7 @@ def interpret(source, frame, should_fail=False):
if should_fail:
return ("(assertion failed, but when it was re-run for "
"printing intermediate values, it did not fail. Suggestions: "
"compute assert expression before the assert or use --nomagic)")
"compute assert expression before the assert or use --assert=plain)")
else:
return None

View File

@ -421,7 +421,7 @@ class AssertionRewriter(ast.NodeVisitor):
if chain:
where = []
if len(chain) > 1:
cond = ast.Boolop(ast.And(), chain)
cond = ast.BoolOp(ast.And(), list(chain))
else:
cond = chain[0]
self.statements.append(ast.If(cond, where, []))

View File

@ -240,6 +240,8 @@ easy to rewrite the assertion and avoid any trouble::
All assert introspection can be turned off by passing ``--assert=plain``.
For further information, Benjamin Peterson wrote up `Behind the scenes of py.test's new assertion rewriting <http://pybites.blogspot.com/2011/07/behind-scenes-of-pytests-new-assertion.html>`_.
.. versionadded:: 2.1
Add assert rewriting as an alternate introspection technique.

View File

@ -28,6 +28,11 @@ test parametrization:
- `parametrizing tests, generalized`_ (blog post)
- `putting test-hooks into local or global plugins`_ (blog post)
assertion introspection
- `(07/2011) Behind the scenes of py.test's new assertion rewriting
<http://pybites.blogspot.com/2011/07/behind-scenes-of-pytests-new-assertion.html>`_
distributed testing:
- `simultaneously test your code on all platforms`_ (blog entry)

View File

@ -24,7 +24,7 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
version='2.1.0',
version='2.1.1.dev1',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
@ -70,4 +70,4 @@ def make_entry_points():
return {'console_scripts': l}
if __name__ == '__main__':
main()
main()

View File

@ -137,6 +137,10 @@ class TestAssertionRewrite:
g = False
assert f or g
getmsg(f, must_pass=True)
def f():
f = g = h = lambda: True
assert f() and g() and h()
getmsg(f, must_pass=True)
def test_short_circut_evaluation(self):
def f():