def done_callback(): try: # sometimes the value gets set to 2.0 on this vm, so this works assert progress_bar.config['value'] > 1 progress_bar.stop() # prevents funny tk errors finally: # if this doesn't run, the test freezes teek.quit()
def test_before_after_quit(): teek.tcl_eval(None, '') # make sure that a Tcl interpreter is running asd = [] teek.before_quit.connect(asd.append, args=['one']) teek.Menu().bind('<Destroy>', (lambda: asd.append('two'))) teek.after_quit.connect(asd.append, args=['three']) teek.quit() assert asd == ['one', 'two', 'three']
def test_weird_error(capfd): # make sure that previous tests don't mess up teek.after_idle(teek.quit) teek.run() # ignore anything that ended up in the stderr because previous tests # TODO: why is stderr SOMETIMES non-empty?? capfd.readouterr() teek.create_command(print) # the command is intentionally not deleted teek.quit() teek.update() assert capfd.readouterr() == ('', '')
def test_destroy_event(): window = teek.Window() asd = [] window.bind('<Destroy>', asd.append, event=True) teek.quit() assert len(asd) == 1
def done_callback(): assert text.get(text.start, text.end) == 'hello 1\nhello 2\nhello 3\n' teek.quit()
def thread_target(): with pytest.raises(RuntimeError) as error: teek.quit() assert str(error.value) == "can only quit from main thread"