merge heads
This commit is contained in:
commit
46b1348b79
|
@ -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
|
Changes between 2.0.3 and 2.1.0.DEV
|
||||||
----------------------------------------------
|
----------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#
|
#
|
||||||
__version__ = '2.1.0'
|
__version__ = '2.1.1.dev1'
|
||||||
|
|
|
@ -53,7 +53,7 @@ def interpret(source, frame, should_fail=False):
|
||||||
if should_fail:
|
if should_fail:
|
||||||
return ("(assertion failed, but when it was re-run for "
|
return ("(assertion failed, but when it was re-run for "
|
||||||
"printing intermediate values, it did not fail. Suggestions: "
|
"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):
|
def run(offending_line, frame=None):
|
||||||
if frame is None:
|
if frame is None:
|
||||||
|
|
|
@ -482,7 +482,7 @@ def interpret(source, frame, should_fail=False):
|
||||||
if should_fail:
|
if should_fail:
|
||||||
return ("(assertion failed, but when it was re-run for "
|
return ("(assertion failed, but when it was re-run for "
|
||||||
"printing intermediate values, it did not fail. Suggestions: "
|
"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:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,7 @@ class AssertionRewriter(ast.NodeVisitor):
|
||||||
if chain:
|
if chain:
|
||||||
where = []
|
where = []
|
||||||
if len(chain) > 1:
|
if len(chain) > 1:
|
||||||
cond = ast.Boolop(ast.And(), chain)
|
cond = ast.BoolOp(ast.And(), list(chain))
|
||||||
else:
|
else:
|
||||||
cond = chain[0]
|
cond = chain[0]
|
||||||
self.statements.append(ast.If(cond, where, []))
|
self.statements.append(ast.If(cond, where, []))
|
||||||
|
|
|
@ -240,6 +240,8 @@ easy to rewrite the assertion and avoid any trouble::
|
||||||
|
|
||||||
All assert introspection can be turned off by passing ``--assert=plain``.
|
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
|
.. versionadded:: 2.1
|
||||||
Add assert rewriting as an alternate introspection technique.
|
Add assert rewriting as an alternate introspection technique.
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,11 @@ test parametrization:
|
||||||
- `parametrizing tests, generalized`_ (blog post)
|
- `parametrizing tests, generalized`_ (blog post)
|
||||||
- `putting test-hooks into local or global plugins`_ (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:
|
distributed testing:
|
||||||
|
|
||||||
- `simultaneously test your code on all platforms`_ (blog entry)
|
- `simultaneously test your code on all platforms`_ (blog entry)
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -24,7 +24,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.1.0',
|
version='2.1.1.dev1',
|
||||||
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'],
|
||||||
|
|
|
@ -137,6 +137,10 @@ class TestAssertionRewrite:
|
||||||
g = False
|
g = False
|
||||||
assert f or g
|
assert f or g
|
||||||
getmsg(f, must_pass=True)
|
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 test_short_circut_evaluation(self):
|
||||||
def f():
|
def f():
|
||||||
|
|
Loading…
Reference in New Issue