classification
Title: Idle: test SearchDialogBase.py
Type: enhancement Stage: resolved
Components: IDLE Versions: Python 3.5, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: JayKrish, Todd.Rovito, ezio.melotti, philwebster, python-dev, sahutd, serhiy.storchaka, terry.reedy
Priority: normal Keywords: patch

Created on 2013-07-30 01:12 by philwebster, last changed 2014-07-13 21:28 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
test_searchdialogbase.patch philwebster, 2013-07-30 01:13 review
test_searchdialogbase2.patch philwebster, 2013-08-10 21:40 review
18592_test_searchdialog.diff terry.reedy, 2013-08-19 01:17 review
18592_test_searchdialog2.diff philwebster, 2013-09-01 04:22 review
test-search-sdb-18592-34.diff terry.reedy, 2014-06-26 08:15 review
grepdialog_bug.diff sahutd, 2014-07-13 05:48 review
Messages (21)
msg193911 - (view) Author: Phil Webster (philwebster) * Date: 2013-07-30 01:12
This is a basic set of tests for SearchDialogBase. It mainly consists of gui code, so I was not completely sure of how/what to test. Before venturing any further, I thought I would make sure I'm heading in the right direction.
msg194838 - (view) Author: Phil Webster (philwebster) * Date: 2013-08-10 21:40
As suggested by Ezio, I factored out the button tests to a common method.
msg195581 - (view) Author: Roundup Robot (python-dev) Date: 2013-08-18 22:29
New changeset 0d2b87ec9f2b by Terry Jan Reedy in branch '2.7':
Issue #18592: Add docstrings to file being tested (idlelib.SearchDialogBase.py).
http://hg.python.org/cpython/rev/0d2b87ec9f2b

New changeset e09dfdbeb9a2 by Terry Jan Reedy in branch '3.3':
Issue #18592: Add docstrings to file being tested (idlelib.SearchDialogBase.py).
http://hg.python.org/cpython/rev/e09dfdbeb9a2

New changeset 358a2b2fbad4 by Terry Jan Reedy in branch '3.3':
Issue #18592: whitespace
http://hg.python.org/cpython/rev/358a2b2fbad4

New changeset 1f2b78941c4a by Terry Jan Reedy in branch '2.7':
Issue #18592: whitespace
http://hg.python.org/cpython/rev/1f2b78941c4a
msg195582 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-08-18 22:30
I added the docstrings that I wish had already been present.
The only 2.7-3.3 difference in SearchDialogBase is Tkinter/tkinter.
msg195591 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-08-19 01:17
A subtle point about coverage. The target module must be imported.
from idlelib import SearchDialogBase as sdb  # works.
import idlelib.SearchDialogBase as sdb  # does not
at least not as I invoke coveragepy in my batch file.

With this change, the four uncovered lines were "btn.select()" after 
  if self.engine.is/re/case/word/back/():
in create_option_buttons and create_other_buttons. I added a parameter to checkboxtests and a new method test_create_option_buttons_flipped. That leaves the line after isback() and I think the radiobutton test probably covers that anyway.

The attached file has a few other cosmetic changes, like 'self.searchengine' to 'self.engine'.

I would like to remove the duplicate testing in test_create_widgets. All we care for that test is that create_widgets calls the other four create methods. This could be done either by mocking the other methods (unittest.mock or custom replacement) or by looking to see that there is one entry, option button, other button, and command button.

Were you planning to do the check-label todos?
msg195712 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2013-08-20 19:30
For next edit -- docstring for class SearchDialogBase:
>     +    a row of standard radiobuttons (create_option_buttons);
This is wrong -- these are Checkbuttons
>     +    a row of dialog specific radiobuttons (create_other_buttons).
dialog-specific Radiobuttons
msg196699 - (view) Author: Phil Webster (philwebster) * Date: 2013-09-01 04:22
Added tests for labels, a mock function for widget creation, a back option for radiobuttontests, and the docstring fixes that Terry mentioned.
msg221592 - (view) Author: Roundup Robot (python-dev) Date: 2014-06-26 05:41
New changeset 752439a6bdd9 by Terry Jan Reedy in branch '2.7':
Issue #18592: For idlelib.SearchDialogBase, edit and add docstrings,
http://hg.python.org/cpython/rev/752439a6bdd9

New changeset ed60a73e1c82 by Terry Jan Reedy in branch '3.4':
Issue #18592: For idlelib.SearchDialogBase, edit and add docstrings,
http://hg.python.org/cpython/rev/ed60a73e1c82
msg221593 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-06-26 05:44
I am getting the ttk Themechanges warning. The test needs to use an search engine altered as with test_searchengine. I will work on that next.
msg221598 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-06-26 08:15
The warning was due to absence of def self.root. Attached is close to what will commit.
msg221997 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-01 00:05
New changeset 2b7a4cbed2a0 by Terry Jan Reedy in branch '2.7':
Issue #18592: Add unittests for SearchDialogBase. Patch by Phil Webster.
http://hg.python.org/cpython/rev/2b7a4cbed2a0

New changeset a0e8f2d882a3 by Terry Jan Reedy in branch '3.4':
Issue #18592: Add unittests for SearchDialogBase. Patch by Phil Webster.
http://hg.python.org/cpython/rev/a0e8f2d882a3
msg222006 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-01 03:53
New changeset a7f943a13f7f by Terry Jan Reedy in branch '2.7':
Issue #18592: Refactor 2 SearchDialogBase.create_(option/other)_buttons methods
http://hg.python.org/cpython/rev/a7f943a13f7f

New changeset 86c26ff25207 by Terry Jan Reedy in branch '3.4':
Issue #18592: Refactor 2 SearchDialogBase.create_(option/other)_buttons methods
http://hg.python.org/cpython/rev/86c26ff25207
msg222464 - (view) Author: Saimadhav Heblikar (sahutd) * Date: 2014-07-07 13:56
Hi,
test_make_entry seems to be failing (for eg: http://buildbot.python.org/all/builders/AMD64%20Debian%20root%203.4/builds/306/steps/test/logs/stdio and http://buildbot.python.org/all/builders/AMD64%20Debian%20root%203.x/builds/911/steps/test/logs/stdio)

======================================================================
FAIL: test_make_entry (idlelib.idle_test.test_searchdialogbase.SearchDialogBaseTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/idlelib/idle_test/test_searchdialogbase.py", line 83, in test_make_entry
    equal(egi['row'], 0)
AssertionError: '0' != 0

----------------------------------------------------------------------
Ran 128 tests in 0.779s

FAILED (failures=1)
test test_idle failed


Attach patch fixes it in a straight forward way.
msg222484 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-07 17:41
Serhiy: we are having a problem with tkinter sometimes reporting boolean vars as '0' and '1' versus 0 and 1. As I remember, you pushed a patch about this in the last year, probably before 3.4 came out, but after last August. Am I correct?  If so, do you remember the issue?

Saimadhav: changing expected values *back* to '0'/'1', as in Phil's original patch, will make the test fail on all the systems (including all stable buildbots) that *do* return  0/1. After Serhiy's fix, I had to switch to 0/1 for 3.4/5 to make the tests pass again, after the change made them fail. Notice that the 2.7 version, pushed on 6/30 also, still has '0', '1'.

The interesting question is why the Debian 3.4 system is different?  Why is it acting like 2.7?  Serhiy, do you have any idea? 

I am also puzzled why the corresponding text_tcl or _tk did not fail, as I presume there is a text for the change.
msg222485 - (view) Author: Saimadhav Heblikar (sahutd) * Date: 2014-07-07 17:51
>The interesting question is why the Debian 3.4 system is different? 
That is what caused me to notice the issue. I ran the IDLE test suite on my pc(debian 7) and it failed, while most buildbots were "green".

>Why is it acting like 2.7?  Serhiy, do you have any idea? 
2.7 with '0'/'1' is passing.

(I am removing the patch as this issue has a background that I was not aware of.)
msg222488 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-07 18:13
What micro tk version? as in

>>> t = tk.Tk()
>>> t.tk.call('info', 'patchlevel')
'8.5.15'
msg222513 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2014-07-07 20:40
I pushed a patch which fixed Text.debug(). This is not related to this issue.

grid_info() values are depend on Tcl/Tk version. When < 8.6 strings are always returned (except the 'in' key which is special case), when >= 8.6 values can be integers or even tuples. I introduced the AbstractWidgetTest._str() method to convert expected value in widget tests.

In these tests you can just write equal(int(egi['row']), 0).
msg222544 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-07-08 04:50
Ah, Debian must not be using 8.6. Thanks for both the clarification and how to fix.
msg222723 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-11 04:38
New changeset 30a75f75a4d4 by Terry Jan Reedy in branch '2.7':
Issue #18592: Make unittest for SearchDialogBase work on all tk versions.
http://hg.python.org/cpython/rev/30a75f75a4d4

New changeset 91546aa91cee by Terry Jan Reedy in branch '3.4':
Issue #18592: Make unittest for SearchDialogBase work on all tk versions.
http://hg.python.org/cpython/rev/91546aa91cee
msg222914 - (view) Author: Saimadhav Heblikar (sahutd) * Date: 2014-07-13 05:48
A bug introduced by 91491:a0e8f2d882a3.

Opening Find-in-files gives the following error

Exception in Tkinter callback
Traceback (most recent call last):
  File "/home/saimadhav/dev/34-cpython/Lib/tkinter/__init__.py", line 1487, in __call__
.
.
<SNIPPED>
.
.
    self.tk = master.tk
AttributeError: 'tuple' object has no attribute 'tk'
msg222976 - (view) Author: Roundup Robot (python-dev) Date: 2014-07-13 21:28
New changeset b6c5719e0f4e by Terry Jan Reedy in branch '2.7':
Issue #18592: Method return signature changes made to SearchDialogBase for
http://hg.python.org/cpython/rev/b6c5719e0f4e

New changeset 407110796b16 by Terry Jan Reedy in branch '3.4':
Issue #18592: Method return signature changes made to SearchDialogBase for
http://hg.python.org/cpython/rev/407110796b16
History
Date User Action Args
2014-07-13 21:28:26python-devsetmessages: + msg222976
2014-07-13 05:48:29sahutdsetfiles: + grepdialog_bug.diff

messages: + msg222914
2014-07-11 04:38:12python-devsetmessages: + msg222723
2014-07-08 04:50:11terry.reedysetmessages: + msg222544
2014-07-07 20:40:24serhiy.storchakasetmessages: + msg222513
2014-07-07 18:13:25terry.reedysetmessages: + msg222488
2014-07-07 17:51:28sahutdsetfiles: - issue18592-fix.diff
2014-07-07 17:51:05sahutdsetmessages: + msg222485
2014-07-07 17:41:24terry.reedysetnosy: + serhiy.storchaka
messages: + msg222484
2014-07-07 13:56:29sahutdsetfiles: + issue18592-fix.diff
nosy: + sahutd
messages: + msg222464

2014-07-01 03:54:03terry.reedysetstatus: open -> closed
resolution: fixed
stage: commit review -> resolved
2014-07-01 03:53:01python-devsetmessages: + msg222006
2014-07-01 00:05:11python-devsetmessages: + msg221997
2014-06-26 08:15:32terry.reedysetfiles: + test-search-sdb-18592-34.diff

messages: + msg221598
stage: needs patch -> commit review
2014-06-26 05:44:03terry.reedysetmessages: + msg221593
stage: patch review -> needs patch
2014-06-26 05:41:29python-devsetmessages: + msg221592
2014-06-01 22:10:19terry.reedysettitle: IDLE: Unit test for SearchDialogBase.py -> Idle: test SearchDialogBase.py
versions: + Python 3.5, - Python 3.3
2013-09-01 04:22:36philwebstersetfiles: + 18592_test_searchdialog2.diff

messages: + msg196699
2013-08-20 19:30:18terry.reedysetmessages: + msg195712
2013-08-19 01:17:49terry.reedysetfiles: + 18592_test_searchdialog.diff

messages: + msg195591
2013-08-18 22:30:21terry.reedysetassignee: terry.reedy
messages: + msg195582
stage: patch review
2013-08-18 22:29:22python-devsetnosy: + python-dev
messages: + msg195581
2013-08-10 21:40:09philwebstersetfiles: + test_searchdialogbase2.patch

messages: + msg194838
2013-08-08 13:57:18ezio.melottisetnosy: + ezio.melotti
2013-07-30 01:13:08philwebstersetfiles: + test_searchdialogbase.patch
keywords: + patch
2013-07-30 01:12:50philwebstercreate