Interpret assignments while examining asserts corrects
fixes #105 --HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									add518e6b6
								
							
						
					
					
						commit
						610cde6f85
					
				|  | @ -34,6 +34,7 @@ New features | |||
| Bug fixes / Maintenance | ||||
| ++++++++++++++++++++++++++ | ||||
| 
 | ||||
| - fix issue105 assignment on the same line as a failing assertion | ||||
| - fix issue104 proper escaping for test names in junitxml plugin | ||||
| - fix issue57 -f|--looponfail to work with xpassing tests | ||||
| - fix pyimport() to work with directories | ||||
|  |  | |||
|  | @ -324,10 +324,11 @@ class DebugInterpreter(ast.NodeVisitor): | |||
|     def visit_Assign(self, assign): | ||||
|         value_explanation, value_result = self.visit(assign.value) | ||||
|         explanation = "... = %s" % (value_explanation,) | ||||
|         name = ast.Name("__exprinfo_expr", ast.Load(), assign.value.lineno, | ||||
|                         assign.value.col_offset) | ||||
|         new_assign = ast.Assign(assign.targets, name, assign.lineno, | ||||
|                                 assign.col_offset) | ||||
|         name = ast.Name("__exprinfo_expr", ast.Load(), | ||||
|                         lineno=assign.value.lineno, | ||||
|                         col_offset=assign.value.col_offset) | ||||
|         new_assign = ast.Assign(assign.targets, name, lineno=assign.lineno, | ||||
|                                 col_offset=assign.col_offset) | ||||
|         mod = ast.Module([new_assign]) | ||||
|         co = self._compile(mod, "exec") | ||||
|         try: | ||||
|  |  | |||
|  | @ -139,6 +139,13 @@ def test_assert_with_brokenrepr_arg(): | |||
|     if e.msg.find("broken __repr__") == -1: | ||||
|         py.test.fail("broken __repr__ not handle correctly") | ||||
| 
 | ||||
| def test_multiple_statements_per_line(): | ||||
|     try: | ||||
|         a = 1; assert a == 2 | ||||
|     except AssertionError: | ||||
|         e = exvalue() | ||||
|         assert "assert 1 == 2" in e.msg | ||||
| 
 | ||||
| 
 | ||||
| class TestView: | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue