예제 #1
0
 def run(self):
     log("method Test")
     run()
예제 #2
0
 def run2(self):
     log("method Test2")
     t = Run()
     t.run()
예제 #3
0
 def run3(self):
     log("method Test3")
     run()
예제 #4
0
def other_run():
    # Test too large values for stack_level
    # stack_level should exceed nosetests stack levels as well
    log("function other_run()", stack_level=100)
예제 #5
0
def run():
    log("function run()")
예제 #6
0
    # Stack containing two matching objects
    with capture_output() as out:
        t = Run2()
        t.run2()
    assert_equal(out[0],
                 "[Run2.run2] method Test2\n"
                 "[Run2.run2] method Test\n"
                 "[Run2.run2] function run()\n")

    # Stack containing one matching object
    with capture_output() as out:
        t = Run()
        t.run()
    assert_equal(out[0],
                 "[Run.run] method Test\n[Run.run] function run()\n")

    # Stack containing no object
    with capture_output() as out:
        run()
    assert_equal(out[0], "[run] function run()\n")

    # Test stack_level too large
    with capture_output() as out:
        other_run()
    assert_equal(out[0], "[<top_level>] function other_run()\n")

# Will be executed by nosetests upon importing
with capture_output() as out:
    log("message from no function")
assert_equal(out[0], "[<module>] message from no function\n")