This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Rearrange tkinter tests, use test discovery
Type: enhancement Stage: resolved
Components: Tests, Tkinter Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: out of date
Dependencies: 22236 Superseder:
Assigned To: Nosy List: iritkatriel, serhiy.storchaka, terry.reedy, zach.ware
Priority: normal Keywords: patch

Created on 2014-08-23 20:10 by zach.ware, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_tkinter.diff zach.ware, 2014-08-23 20:10
test_tkinter.v2.diff zach.ware, 2014-08-25 05:27
Messages (6)
msg225760 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-08-23 20:10
The attached patch rearranges the tkinter tests and strips out all of their custom test finding/loading code in favor of test discovery.  The high points:

- Lib/tkinter/test/ -> Lib/test/test_tkinter/,
  Lib/tkinter/test/test_tkinter/ -> Lib/test/test_tkinter/test_tk/ (all other files keep the same name)
- Lib/test/test_tcl.py -> Lib/test/test_tkinter/test_tcl.py
- test_tk.py, test_ttk_guionly.py, and test_ttk_textonly.py in Lib/test/ disappear.
- setUpModule in test_tkinter.widget_tests is renamed and moved to test_tkinter.support as setUpGUIModule, which takes the name of the module as an argument for a nice message from test.support.requires('gui').  I'm not entirely happy with how setUpGUIModule turned out and works, suggestions are very welcome.
- each ttk test uses a new test_tkinter.support.check_ttk_availability, which is based on the toplevel code from the old test.test_ttk_guionly.  I haven't had a chance to test how it works on a system without ttk.
msg225761 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-08-23 20:33
This will need some reworking after #22236, which looks like it might make it possible for 'setUpGUIModule' to go away by folding its contents into AbstractTkTest.setUpClass.
msg225798 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-24 07:08
Currently Tkinter tests are splitted on four tests: test_tcl, test_tk, test_ttk_textonly, test_ttk_guionly. Ttk tests are separated because ttk is optional on Tk 8.4 and because ttk is separate large part of Tkinter. test_tcl and test_ttk_textonly are separated because they don't require GUI. On headless computer test_tk and test_ttk_guionly are reported as skipped at all, but test_tcl and test_ttk_textonly should run. It would be good to preserve this splitting and even improve it (test_variables does not require GUI and can be moved to test_tcl package).

Tkinter tests are still incomplete and needs many test. To avoid obstacles for backporting new tests it is worth to apply these changes to all maintained branches.
msg225866 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2014-08-25 05:27
Here's a new version of the patch, post-#22236.  Serhiy, since you want this in 2.7 and 3.4, this version doesn't move any files around (except Lib/test/test_tcl.py), which should make backporting easier.

I like this patch much better than the original, it's a much smaller diff and doesn't have to mess around with a 'setUpGUIModule' function.

The desegregation of test_tcl, test_tk, test_ttk_guionly and test_ttk_textonly is intentional: with the patch, all of the tests that require the gui are properly guarded by test.support.requires('gui'), and the ttk gui tests are additionally guarded by the new 'tkinter.test.support.check_ttk_availability' function (which I still have yet to test against Tk 8.4, but plan to shortly).  This means that by doing 'python -m test test_tkinter', all gui-less tests are run (namely, the current test_tcl and test_ttk_textonly, and also test_variables) and all the gui tests are reported as skipped.  Meanwhile, doing 'python -m test -uall test_tkinter' or 'python -m tkinter.test', all 935 tkinter tests are run (if a gui is in fact available).  Currently, the shortest invocation for running all of the tkinter tests that I know of is 'python -m test -uall test_tcl test_tk test_ttk_guionly test_ttk_textonly', which is quite a handful to type every time :).  If you really want the old subsets, they're still available as 'python -m tkinter.test.test_(tcl|tkinter|ttk|ttk.test_functions)' (though 'tkinter.test.test_ttk' will also run the 'ttk_textonly' tests).
msg225887 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-08-25 18:16
Currently when I run

    DISPLAY= ./python -Wall -b -m test.regrtest -vu gui test_tcl test_tk test_ttk_textonly test_ttk_guionly

skipped tests are enumerated at the end of test log:

2 tests OK.
2 tests skipped:
    test_tk test_ttk_guionly

With the patch the result of

    DISPLAY= ./python -Wall -b -m test.regrtest -vuall test_tcl test_tkinter

is:

OK (skipped=33)
All 2 tests OK.

There is a difference. In first case it is clean that entire component is unusable on current platform or configuration. In second case entire test is reported as successfully passed in general, only several testcases are skipped, but their reports are lost in the middle of long log.
msg415813 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-03-22 21:13
The patch looks very out of date. Let mw know if it's still needed, otherwise I'll close.
History
Date User Action Args
2022-04-11 14:58:07adminsetgithub: 66456
2022-03-30 21:22:50iritkatrielsetstatus: pending -> closed
resolution: out of date
stage: patch review -> resolved
2022-03-22 21:13:10iritkatrielsetstatus: open -> pending
nosy: + iritkatriel
messages: + msg415813

2014-08-25 18:16:56serhiy.storchakasetmessages: + msg225887
2014-08-25 05:27:39zach.waresetfiles: + test_tkinter.v2.diff

messages: + msg225866
2014-08-24 07:08:59serhiy.storchakasetmessages: + msg225798
versions: + Python 2.7, Python 3.4
2014-08-23 20:33:06zach.waresetdependencies: + Do not use _default_root in Tkinter tests
messages: + msg225761
2014-08-23 20:10:39zach.warecreate