annotate Lib/test/test_tk.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents 7641a3f0b2ec
children 3dbc6207cbf6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
51487
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
1 import os
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
2 import sys
52426
71b69a873d21 add missing import
Benjamin Peterson <benjamin@python.org>
parents: 52353
diff changeset
3 import unittest
52555
7641a3f0b2ec A few more test skips via import_module, and change import_module to
R. David Murray <rdmurray@bitdance.com>
parents: 52426
diff changeset
4 from test import test_support
7641a3f0b2ec A few more test skips via import_module, and change import_module to
R. David Murray <rdmurray@bitdance.com>
parents: 52426
diff changeset
5
7641a3f0b2ec A few more test skips via import_module, and change import_module to
R. David Murray <rdmurray@bitdance.com>
parents: 52426
diff changeset
6 # Skip test if _tkinter wasn't built.
7641a3f0b2ec A few more test skips via import_module, and change import_module to
R. David Murray <rdmurray@bitdance.com>
parents: 52426
diff changeset
7 test_support.import_module('_tkinter')
7641a3f0b2ec A few more test skips via import_module, and change import_module to
R. David Murray <rdmurray@bitdance.com>
parents: 52426
diff changeset
8
51489
bdde44af9744 Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly)
Guilherme Polo <ggpolo@gmail.com>
parents: 51487
diff changeset
9 import Tkinter
51487
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
10
51489
bdde44af9744 Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly)
Guilherme Polo <ggpolo@gmail.com>
parents: 51487
diff changeset
11 try:
bdde44af9744 Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly)
Guilherme Polo <ggpolo@gmail.com>
parents: 51487
diff changeset
12 Tkinter.Button()
bdde44af9744 Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly)
Guilherme Polo <ggpolo@gmail.com>
parents: 51487
diff changeset
13 except Tkinter.TclError, msg:
bdde44af9744 Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly)
Guilherme Polo <ggpolo@gmail.com>
parents: 51487
diff changeset
14 # assuming tk is not available
52353
e6009b9cd908 remove test_support.TestSkipped and just use unittest.SkipTest
Benjamin Peterson <benjamin@python.org>
parents: 51489
diff changeset
15 raise unittest.SkipTest("tk not available: %s" % msg)
51489
bdde44af9744 Checking for tk availability before continuing (basically the same that is done in test_ttk_guionly)
Guilherme Polo <ggpolo@gmail.com>
parents: 51487
diff changeset
16
51487
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
17 this_dir = os.path.dirname(os.path.abspath(__file__))
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
18 lib_tk_test = os.path.abspath(os.path.join(this_dir, os.path.pardir,
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
19 'lib-tk', 'test'))
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
20 if lib_tk_test not in sys.path:
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
21 sys.path.append(lib_tk_test)
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
22
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
23 import runtktests
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
24
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
25 def test_main(enable_gui=False):
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
26 if enable_gui:
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
27 if test_support.use_resources is None:
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
28 test_support.use_resources = ['gui']
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
29 elif 'gui' not in test_support.use_resources:
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
30 test_support.use_resources.append('gui')
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
31
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
32 test_support.run_unittest(
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
33 *runtktests.get_tests(text=False, packages=['test_tkinter']))
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
34
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
35 if __name__ == '__main__':
6745bdaa9b49 Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff changeset
36 test_main(enable_gui=True)