title: How do I run unittest on a Tkinter app?
body: <p>I've just begun learning about <a href="http://en.wikipedia.org/wiki/Test-driven_development" rel="noreferrer">TDD</a>, and I'm developing a program using a Tkinter GUI. The only problem is that once the <code>.mainloop()</code> method is called, the test suite hangs until the window is closed.</p>
  
  <p>Here is an example of my code:</p>
  
  <pre><code># server.py
  import Tkinter as tk
  
  class Server(tk.Tk):
      def __init__(self):
          tk.Tk.__init__(self)
          self.mainloop()
  </code></pre>
  
  <p></p>
  
  <pre><code># test.py
  import unittest
  import server
  
  class ServerTestCase(unittest.TestCase):
      def testClassSetup(self):
         server.Server()
         # and of course I can't call any server.whatever functions here
  
  if __name__ == '__main__':
      unittest.main()
  </code></pre>
  
  <p>What is the appropriate way of testing Tkinter apps? Or is it just 'dont'?</p>