enable assertion reinterpretation on 3k
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									c791610998
								
							
						
					
					
						commit
						54709bcae1
					
				| 
						 | 
					@ -96,7 +96,7 @@ class TestFailing(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
 | 
					    def test_reinterpret_fails_with_print_for_the_fun_of_it(self):
 | 
				
			||||||
        l = [1,2,3]
 | 
					        l = [1,2,3]
 | 
				
			||||||
        print "l is", l
 | 
					        print ("l is %r" % l)
 | 
				
			||||||
        a,b = l.pop()
 | 
					        a,b = l.pop()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_some_error(self):
 | 
					    def test_some_error(self):
 | 
				
			||||||
| 
						 | 
					@ -113,7 +113,7 @@ def test_dynamic_compile_shows_nicely():
 | 
				
			||||||
    name = 'abc-123'
 | 
					    name = 'abc-123'
 | 
				
			||||||
    module = py.std.imp.new_module(name)
 | 
					    module = py.std.imp.new_module(name)
 | 
				
			||||||
    code = py.code.compile(src, name, 'exec')
 | 
					    code = py.code.compile(src, name, 'exec')
 | 
				
			||||||
    exec code in module.__dict__
 | 
					    py.builtin.exec_(code, module.__dict__)
 | 
				
			||||||
    py.std.sys.modules[name] = module
 | 
					    py.std.sys.modules[name] = module
 | 
				
			||||||
    module.foo()
 | 
					    module.foo()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,11 +8,7 @@ def pytest_addoption(parser):
 | 
				
			||||||
        help="disable python assert expression reinterpretation."),
 | 
					        help="disable python assert expression reinterpretation."),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def pytest_configure(config):
 | 
					def pytest_configure(config):
 | 
				
			||||||
    # XXX
 | 
					    if not config.getvalue("noassert") and not config.getvalue("nomagic"):
 | 
				
			||||||
    if sys.version_info >= (3,0):
 | 
					 | 
				
			||||||
        return
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if not config.getvalue("noassert"):
 | 
					 | 
				
			||||||
        warn_about_missing_assertion()
 | 
					        warn_about_missing_assertion()
 | 
				
			||||||
        config._oldassertion = py.builtin.builtins.AssertionError
 | 
					        config._oldassertion = py.builtin.builtins.AssertionError
 | 
				
			||||||
        py.builtin.builtins.AssertionError = py.code._AssertionError 
 | 
					        py.builtin.builtins.AssertionError = py.code._AssertionError 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue