def test_cp11923_first():
    try:
        _t_test = testpath.public_testdir + "\\cp11923.py"
        write_to_file(_t_test, """def f():
    x = 'something bad'
    raise Exception(x)""")
        
        import cp11923
        for i in xrange(3):
            try:
                cp11923.f()
            except:
                assert_traceback([(Line263 + 11, 69, 'test_traceback.py', 'test_cp11923_first'), (3, 22, get_full_dir_name(_t_test).lower(), 'f')])
            reload(cp11923)
        
    finally:
        import nt
        nt.unlink(_t_test)
def test_cp11923_first():
    try:
        _t_test = testpath.public_testdir + "\\cp11923.py"
        write_to_file(_t_test, """def f():
    x = 'something bad'
    raise Exception(x)""")
        
        import cp11923
        for i in xrange(3):
            try:
                cp11923.f()
            except:
                assert_traceback([(Line263 + 11, 69, 'test_traceback.py', 'test_cp11923_first'), (3, 22, get_full_dir_name(_t_test).lower(), 'f')])
            reload(cp11923)
        
    finally:
        import nt
        nt.unlink(_t_test)
Example #3
0
    def test_cp11923_first(self):
        line_num = getlineno(lambda _: None)
        try:
            _t_test = os.path.join(os.getcwd(), "cp11923.py")
            with open(_t_test, "w") as f:
                f.write("""
def f():
    x = 'something bad'
    raise Exception(x)""")

            import cp11923
            for i in range(3):
                try:
                    cp11923.f()
                except:
                    self.assert_traceback([(line_num + 12, 69, FILE,
                                            'test_cp11923_first'),
                                           (4, 22, _t_test, 'f')])
                import importlib
                importlib.reload(cp11923)

        finally:
            os.remove(_t_test)