I\'ve just begun learning about TDD, and I\'m developing a program using a Tkinter GUI. The only problem is that once the .mainloop()
method is called, the test
One thing you can do is spawn the mainloop in a separate thread and use your main thread to run the actual tests; watch the mainloop thread as it were. Make sure you check the state of the Tk window before doing your asserts.
Multithreading any code is hard. You may want to break your Tk program down into testable pieces instead of unit testing the entire thing at once (which really isn't unit testing).
I would finally suggest testing at least at the control level if not lower for your program, it will help you tremendously.