classification
Title: Idle: test configHelpSourceEdit
Type: enhancement Stage: resolved
Components: IDLE, Tests Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Saimadhav.Heblikar, Todd.Rovito, martin.panter, python-dev, serhiy.storchaka, taleinat, terry.reedy
Priority: normal Keywords: patch

Created on 2014-02-16 15:08 by Saimadhav.Heblikar, last changed 2016-05-16 00:18 by martin.panter. This issue is now closed.

Files
File name Uploaded Description Edit
idle-test-config-help-source.patch Saimadhav.Heblikar, 2014-02-16 15:08 review
test-help-source.diff terry.reedy, 2014-02-16 18:39 review
test-cfg-help-34.diff Saimadhav.Heblikar, 2014-06-02 11:37 Updated patch for 3.4. review
test-cfg-help-27.diff Saimadhav.Heblikar, 2014-06-02 11:37 review
Messages (12)
msg211319 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2014-02-16 15:08
This patch adds tests for Idle's configHelpSourceEdit.py module.

There is however, a minor issue related to this patch,which is an attribute error occurring due to lines 108,115,128,139 on http://hg.python.org/cpython/file/eef7899ea7ab/Lib/idlelib/configHelpSourceEdit.py 
The error occurring is an attribute error,wherein 'entryMenu' and 'entryPath' attributes are not found. Clearly,the two attributes are created in CreateWidgets() defined on lines 52 and 57.
Other attributes defined in the same CreateWidgets() like menu and path dont raise any attribute error.

I have asked the same in irc,where i was advised to post this patch with the issue mentioned.

Bear with me,i have tried a lot to overcome this issue,but no avail.Please let me know how to fix this.

The test other than this issue,should integrate well.
msg211336 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-02-16 18:39
The new file is modeled on test_config_name.py, as appropriate. I think this was a good choice for a first test file. The complication you stumbled across is that the config help-source dialog has two entry boxes, whereas the config name dialog only has one. Therefore, the help-source check functions set the focus to the appropriate box when detecting an error, whereas the focus remains on the one box when the name check function detects an error.

Problem: the assertEquals on lines 41, 47, 57, and 64 in the test file fail with AttributeErrors attributed to lines 108, 115, 128, and 139 in the module. The failing module lines all look like
   self.entry(Menu/Path).focus_set()

Reason: The error message is "'dummy_helpsource_dialog' object has no attribute 'entry(Menu/Path)'". This is true: the *dummy class instances* do not have such attributes.

Solution: add a mock Entry class to mock_tk with a dummy .focus_set method. Add mock Entry instances to dummy_helpsource_dialog as .entryMenu and .entryPath attributes. Tests now run. See 3.3 patch, which should almost work on 2.7.

I still have to review the actual tests, but I anticipate applying this with whatever additional changes I think are needed.

Also, when I added test_config_name.py in #18130, rev84040, I found and fixed a buglet in method NameOk(), now name_ok(), and otherwise brought the module code up to PEP8 standards. I want to check that MenuOk and PathOk do not have a similar buglet, and look at the style also.
msg211468 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2014-02-18 01:46
Patch for adding configHelpsourceEdit test for python 3.3.I have hand tested it along with tests and it works well.
Also removes certain pep8 violation in configHelpSourceEdit 
Adds a mock Entry class to idle_test/mock_tk (required for a .focus_set())
msg211473 - (view) Author: Saimadhav Heblikar (Saimadhav.Heblikar) * Date: 2014-02-18 03:24
Corresponding patch for 2.7
msg219526 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-06-01 21:31
Please redo 3.3 patch for current 3.4 (after htest change).
msg265582 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-15 05:31
New changeset c05689e630d3 by Terry Jan Reedy in branch '3.5':
Issue #20640: Add tests for idlelib.configHelpSourceEdit.
https://hg.python.org/cpython/rev/c05689e630d3
msg265583 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-05-15 05:37
The glitch with the section name was that the second time the name was pulled from the StringVar, it was not stripped.  The possible fixes were to strip after the second get, get once in ok(), strip, and pass to name_ok, or get once in name_ok, strip, and return to ok().  Both the latter two simplify the code a bit.

For help-source, the second gets were alreads stripped as well, so the glitch is not present.  I applied the patch as posted.  If I were to make a change to get once, I would do it in ok rather than in xyz_ok.  Maybe when I combine the files.
msg265606 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-05-15 09:33
FYI this broke the OS X buildbots:

======================================================================
FAIL: test_ok (idlelib.idle_test.test_config_help.ConfigHelpTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.5.bolen-tiger/build/Lib/idlelib/idle_test/test_config_help.py", line 96, in test_ok
    'https://docs.python.org'))
AssertionError: ['help', 'file://https://docs.python.org'] != ('help', 'https://docs.python.org')

======================================================================
FAIL: test_idlever (idlelib.idle_test.test_warning.ImportWarnTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.5.bolen-tiger/build/Lib/idlelib/idle_test/test_warning.py", line 76, in test_idlever
    self.assertEqual(len(w), 1)
AssertionError: 0 != 1

(I’m partly to blame for the current 3.x OS X breakage, but not 3.5.)
msg265608 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-15 09:43
For test_idlever see issue25747.
msg265634 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-05-15 17:25
New changeset ada719145597 by Terry Jan Reedy in branch '3.5':
Issue #20640: Add https: to url prefixes so test passes on Darwin.
https://hg.python.org/cpython/rev/ada719145597
msg265636 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-05-15 17:27
Patch should fix test for this issue.  Please retest and close if it does.
msg265657 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2016-05-16 00:18
Yep all four buildbots, x86 Tiger and AMD64 Snow Leop, 3.5 and 3.x, are now green.
History
Date User Action Args
2016-05-16 00:18:05martin.pantersetstatus: open -> closed

messages: + msg265657
2016-05-15 17:27:59terry.reedysetmessages: + msg265636
2016-05-15 17:25:58python-devsetmessages: + msg265634
2016-05-15 09:43:02serhiy.storchakasetmessages: + msg265608
2016-05-15 09:33:52martin.pantersetstatus: closed -> open
nosy: + martin.panter
messages: + msg265606

2016-05-15 05:37:02terry.reedysetstatus: open -> closed
versions: + Python 3.6, - Python 2.7, Python 3.4
messages: + msg265583

assignee: terry.reedy
resolution: fixed
stage: patch review -> resolved
2016-05-15 05:31:20python-devsetnosy: + python-dev
messages: + msg265582
2014-06-02 11:37:49Saimadhav.Heblikarsetfiles: + test-cfg-help-27.diff
2014-06-02 11:37:08Saimadhav.Heblikarsetfiles: + test-cfg-help-34.diff
2014-06-02 11:28:59Saimadhav.Heblikarsetfiles: - test-config-helpsource-27.patch
2014-06-02 11:28:56Saimadhav.Heblikarsetfiles: - test-config-helpsource-33.patch
2014-06-01 21:31:26terry.reedysettitle: Adds idle test for configHelpSourceEdit -> Idle: test configHelpSourceEdit
messages: + msg219526
versions: + Python 3.5, - Python 3.3
2014-02-18 03:24:10Saimadhav.Heblikarsetfiles: + test-config-helpsource-27.patch

messages: + msg211473
2014-02-18 01:46:31Saimadhav.Heblikarsetfiles: + test-config-helpsource-33.patch

messages: + msg211468
2014-02-16 18:39:15terry.reedysetfiles: + test-help-source.diff
versions: + Python 2.7, Python 3.3
messages: + msg211336

type: enhancement
stage: patch review
2014-02-16 15:39:18Todd.Rovitosetnosy: + Todd.Rovito
2014-02-16 15:08:45Saimadhav.Heblikarcreate