Mercurial > cpython-lru_cache-weakref
annotate Lib/test/test_tk.py @ 79675:c0a2294de787 2.7
Issue #16199: Backport 2to3 typo fix from 3.2.
| author | Chris Jerdonek <chris.jerdonek@gmail.com> |
|---|---|
| date | Thu, 11 Oct 2012 16:15:46 -0700 |
| parents | ea02eca122b5 |
| children |
| rev | line source |
|---|---|
|
51487
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
1 import os |
|
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
|
2 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
|
3 |
|
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 # 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
|
5 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
|
6 |
|
51487
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
7 this_dir = os.path.dirname(os.path.abspath(__file__)) |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
8 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
|
9 'lib-tk', 'test')) |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
10 |
|
56588
3dbc6207cbf6
Restore sys.path in test_tk
Nick Coghlan <ncoghlan@gmail.com>
parents:
52555
diff
changeset
|
11 with test_support.DirsOnSysPath(lib_tk_test): |
|
3dbc6207cbf6
Restore sys.path in test_tk
Nick Coghlan <ncoghlan@gmail.com>
parents:
52555
diff
changeset
|
12 import runtktests |
|
51487
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
13 |
|
71184
ea02eca122b5
Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run
Ned Deily <nad@acm.org>
parents:
58817
diff
changeset
|
14 # Skip test if tk cannot be initialized. |
|
ea02eca122b5
Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run
Ned Deily <nad@acm.org>
parents:
58817
diff
changeset
|
15 runtktests.check_tk_availability() |
|
ea02eca122b5
Issue #8716: Avoid crashes caused by Aqua Tk on OSX when attempting to run
Ned Deily <nad@acm.org>
parents:
58817
diff
changeset
|
16 |
|
51487
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
17 def test_main(enable_gui=False): |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
18 if enable_gui: |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
19 if test_support.use_resources is None: |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
20 test_support.use_resources = ['gui'] |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
21 elif 'gui' not in test_support.use_resources: |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
22 test_support.use_resources.append('gui') |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
23 |
|
56588
3dbc6207cbf6
Restore sys.path in test_tk
Nick Coghlan <ncoghlan@gmail.com>
parents:
52555
diff
changeset
|
24 with test_support.DirsOnSysPath(lib_tk_test): |
|
3dbc6207cbf6
Restore sys.path in test_tk
Nick Coghlan <ncoghlan@gmail.com>
parents:
52555
diff
changeset
|
25 test_support.run_unittest( |
|
51487
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
26 *runtktests.get_tests(text=False, packages=['test_tkinter'])) |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
27 |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
28 if __name__ == '__main__': |
|
6745bdaa9b49
Some tests for Tkinter.Text.search
Guilherme Polo <ggpolo@gmail.com>
parents:
diff
changeset
|
29 test_main(enable_gui=True) |
