class FakeTk(object):

    def mainloop(self):
        pass
tk.__dict__['Tk'] = FakeTk
import server

def test_server():
    s = server.Server()
server.mainloop()
How do I run unittest on a Tkinter app?