Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idle: test configHelpSourceEdit #64839

Closed
SaimadhavHeblikar mannequin opened this issue Feb 16, 2014 · 12 comments
Closed

Idle: test configHelpSourceEdit #64839

SaimadhavHeblikar mannequin opened this issue Feb 16, 2014 · 12 comments
Assignees
Labels
tests Tests in the Lib/test dir topic-IDLE type-feature A feature request or enhancement

Comments

@SaimadhavHeblikar
Copy link
Mannequin

SaimadhavHeblikar mannequin commented Feb 16, 2014

BPO 20640
Nosy @terryjreedy, @taleinat, @rovitotv, @vadmium, @serhiy-storchaka
Files
  • idle-test-config-help-source.patch
  • test-help-source.diff
  • test-cfg-help-34.diff: Updated patch for 3.4.
  • test-cfg-help-27.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/terryjreedy'
    closed_at = <Date 2016-05-16.00:18:05.082>
    created_at = <Date 2014-02-16.15:08:45.343>
    labels = ['expert-IDLE', 'type-feature', 'tests']
    title = 'Idle: test configHelpSourceEdit'
    updated_at = <Date 2016-05-16.00:18:05.072>
    user = 'https://bugs.python.org/SaimadhavHeblikar'

    bugs.python.org fields:

    activity = <Date 2016-05-16.00:18:05.072>
    actor = 'martin.panter'
    assignee = 'terry.reedy'
    closed = True
    closed_date = <Date 2016-05-16.00:18:05.082>
    closer = 'martin.panter'
    components = ['IDLE', 'Tests']
    creation = <Date 2014-02-16.15:08:45.343>
    creator = 'Saimadhav.Heblikar'
    dependencies = []
    files = ['34101', '34104', '35446', '35447']
    hgrepos = []
    issue_num = 20640
    keywords = ['patch']
    message_count = 12.0
    messages = ['211319', '211336', '211468', '211473', '219526', '265582', '265583', '265606', '265608', '265634', '265636', '265657']
    nosy_count = 7.0
    nosy_names = ['terry.reedy', 'taleinat', 'Todd.Rovito', 'python-dev', 'martin.panter', 'serhiy.storchaka', 'Saimadhav.Heblikar']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue20640'
    versions = ['Python 3.5', 'Python 3.6']

    @SaimadhavHeblikar
    Copy link
    Mannequin Author

    SaimadhavHeblikar mannequin commented Feb 16, 2014

    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.

    @SaimadhavHeblikar SaimadhavHeblikar mannequin added topic-IDLE tests Tests in the Lib/test dir labels Feb 16, 2014
    @terryjreedy
    Copy link
    Member

    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 bpo-18130, rev84040, I found and fixed a buglet in method NameOk(), now name_ok(), and otherwise brought the module code up to PEP-8 standards. I want to check that MenuOk and PathOk do not have a similar buglet, and look at the style also.

    @terryjreedy terryjreedy added the type-feature A feature request or enhancement label Feb 16, 2014
    @SaimadhavHeblikar
    Copy link
    Mannequin Author

    SaimadhavHeblikar mannequin commented Feb 18, 2014

    Patch for adding configHelpsourceEdit test for python 3.3.I have hand tested it along with tests and it works well.
    Also removes certain PEP-8 violation in configHelpSourceEdit
    Adds a mock Entry class to idle_test/mock_tk (required for a .focus_set())

    @SaimadhavHeblikar
    Copy link
    Mannequin Author

    SaimadhavHeblikar mannequin commented Feb 18, 2014

    Corresponding patch for 2.7

    @terryjreedy
    Copy link
    Member

    Please redo 3.3 patch for current 3.4 (after htest change).

    @terryjreedy terryjreedy changed the title Adds idle test for configHelpSourceEdit Idle: test configHelpSourceEdit Jun 1, 2014
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 15, 2016

    New changeset c05689e630d3 by Terry Jan Reedy in branch '3.5':
    Issue bpo-20640: Add tests for idlelib.configHelpSourceEdit.
    https://hg.python.org/cpython/rev/c05689e630d3

    @terryjreedy
    Copy link
    Member

    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.

    @terryjreedy terryjreedy self-assigned this May 15, 2016
    @vadmium
    Copy link
    Member

    vadmium commented May 15, 2016

    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.)

    @vadmium vadmium reopened this May 15, 2016
    @serhiy-storchaka
    Copy link
    Member

    For test_idlever see bpo-25747.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 15, 2016

    New changeset ada719145597 by Terry Jan Reedy in branch '3.5':
    Issue bpo-20640: Add https: to url prefixes so test passes on Darwin.
    https://hg.python.org/cpython/rev/ada719145597

    @terryjreedy
    Copy link
    Member

    Patch should fix test for this issue. Please retest and close if it does.

    @vadmium
    Copy link
    Member

    vadmium commented May 16, 2016

    Yep all four buildbots, x86 Tiger and AMD64 Snow Leop, 3.5 and 3.x, are now green.

    @vadmium vadmium closed this as completed May 16, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir topic-IDLE type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants