~andrewsomething/exaile/karmic

« back to all changes in this revision

Viewing changes to tools/guitest/Tkintertest.py

  • Committer: Aren Olson
  • Date: 2009-09-12 00:36:59 UTC
  • Revision ID: reacocard@gmail.com-20090912003659-w373sg0n04uoa8op
remove useless files, add soem of the fixes from lp bug 420019

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
"""Objects that help unit-test Tkinter applications."""
2
 
 
3
 
import unittest
4
 
from guitest.utils import GuiTestHelperMixin, DoctestHelper
5
 
from guitest.state import guistate
6
 
 
7
 
 
8
 
def Tkinter_mainloop():
9
 
    mainhook = guistate.main
10
 
    if mainhook is None:
11
 
        raise ValueError("mainhook not specified!")
12
 
    else:
13
 
        guistate.main = None # try to avoid infinite recursion
14
 
        guistate.level += 1
15
 
        mainhook()
16
 
 
17
 
 
18
 
#
19
 
# Unit-test and doctest helpers.
20
 
#
21
 
 
22
 
class TkinterTestHelperMixin(GuiTestHelperMixin):
23
 
 
24
 
    toolkit_overrides = {'Tkinter.mainloop': Tkinter_mainloop}
25
 
 
26
 
 
27
 
class TkinterTestCase(TkinterTestHelperMixin, unittest.TestCase):
28
 
    """A convenience TestCase for use in Tkinter application unit tests."""
29
 
 
30
 
# doctest helper
31
 
doctesthelper = DoctestHelper(TkinterTestHelperMixin)
32
 
 
33
 
setUp_param = doctesthelper.setUp_param
34
 
setUp = doctesthelper.setUp
35
 
tearDown = doctesthelper.tearDown