Exemplo n.º 1
0
def test_Application_logger():
    root = logging.getLogger()
    app = Application()
    handler = app.errlog_handler
    assert hasattr(app, "errlog"), app.errlog
    assert handler not in root.handlers, root.handlers
    with app.logger() as errlog:
        handler = app.errlog_handler
        assert handler in root.handlers, root.handlers
    assert handler not in root.handlers, root.handlers
Exemplo n.º 2
0
 def test(c):
     m = Mocker()
     ed = m.mock(Window)
     editor = m.mock(Editor)
     app = Application()
     with app.logger() as errlog:
         err = m.property(app.errlog, "document").value >> m.mock(TextDocument)
         if c.is_open:
             idocs = iter([editor])
             m.method(app.set_current_editor)(editor)
         else:
             idocs = iter([])
             m.method(app.current_window)() >> (ed if c.has_window else None)
             if not c.has_window:
                 m.method(app.create_window)() >> ed
             ed.insert_items([err], focus=True)
         m.method(app.iter_editors_of_document)(err) >> idocs
         with m:
             app.open_error_log()