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

Add tkinter basic options tests #63285

Closed
serhiy-storchaka opened this issue Sep 24, 2013 · 34 comments
Closed

Add tkinter basic options tests #63285

serhiy-storchaka opened this issue Sep 24, 2013 · 34 comments
Assignees
Labels
tests Tests in the Lib/test dir topic-tkinter type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 19085
Nosy @terryjreedy, @ned-deily, @zware, @serhiy-storchaka, @vajrasky
Files
  • tkinter_options_tests.patch
  • tkinter_options_tests_2.patch
  • tkinter_options_tests_3.patch
  • pixels_round.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/serhiy-storchaka'
    closed_at = <Date 2014-02-28.20:39:16.908>
    created_at = <Date 2013-09-24.20:30:31.881>
    labels = ['tests', 'type-feature', 'expert-tkinter']
    title = 'Add tkinter basic options tests'
    updated_at = <Date 2014-02-28.20:39:16.907>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2014-02-28.20:39:16.907>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2014-02-28.20:39:16.908>
    closer = 'serhiy.storchaka'
    components = ['Tests', 'Tkinter']
    creation = <Date 2013-09-24.20:30:31.881>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['31861', '32379', '32441', '32482']
    hgrepos = []
    issue_num = 19085
    keywords = ['patch']
    message_count = 34.0
    messages = ['198366', '199862', '200018', '200024', '201394', '201850', '201965', '201973', '201977', '201979', '202006', '202008', '202023', '202033', '202036', '202163', '202171', '202228', '202230', '202231', '202232', '202233', '202235', '202236', '202237', '202493', '203957', '203974', '203975', '204004', '204286', '212387', '212391', '212472']
    nosy_count = 7.0
    nosy_names = ['terry.reedy', 'gpolo', 'ned.deily', 'python-dev', 'zach.ware', 'serhiy.storchaka', 'vajrasky']
    pr_nums = []
    priority = 'critical'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19085'
    versions = ['Python 2.7', 'Python 3.3', 'Python 3.4']

    @serhiy-storchaka
    Copy link
    Member Author

    The proposed patch adds tests for all options of all widgets. They test that widgets support all documented options, accepts valid values in different formats, reject invalid values, and return values in expected format. This would be helpful for regression testing.

    The patch tested with Tcl/Tk 8.5 and 8.6 on Linux. All new tests are compatible with wantobjects=1 and wantobjects=0.

    It will be good to test it with Tcl/Tk 8.4 (or even 8.3) and on Windows.

    @serhiy-storchaka serhiy-storchaka added tests Tests in the Lib/test dir topic-tkinter type-feature A feature request or enhancement labels Sep 24, 2013
    @serhiy-storchaka
    Copy link
    Member Author

    If there are no objections I'm going to commit this.

    @serhiy-storchaka serhiy-storchaka self-assigned this Oct 14, 2013
    @ned-deily
    Copy link
    Member

    With Aqua Cocoa Tcl/Tk 8.5.14 or 8.6.0 (using ActiveState's 8.5.14 or 8.6.0) on OS X 10.8.5, running test_ttk_guionly:

    ======================================================================
    ERROR: test_class (tkinter.test.test_ttk.test_widgets.ScrollbarTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_ttk/test_widgets.py", line 22, in test_class
        self.assertEqual(widget['class'], '')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1267, in cget
        return self.tk.call(self._w, 'cget', '-' + key)
    _tkinter.TclError: unknown option "-class"

    ======================================================================
    ERROR: test_style (tkinter.test.test_ttk.test_widgets.ScrollbarTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_ttk/test_widgets.py", line 44, in test_style
        self.assertEqual(widget['style'], '')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1267, in cget
        return self.tk.call(self._w, 'cget', '-' + key)
    _tkinter.TclError: unknown option "-style"

    ======================================================================
    FAIL: test_orient (tkinter.test.test_ttk.test_widgets.ScrollbarTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 426, in test_orient
        self.checkEnumParam(widget, 'orient', 'horizontal', 'vertical')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 244, in checkEnumParam
        errmsg='ambiguous' + errmsg2)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 174, in checkInvalidParam
        widget[name] = value
    AssertionError: TclError not raised

    Ran 233 tests in 2.823s

    FAILED (failures=1, errors=2, skipped=1)
    test test_ttk_guionly failed
    1 test failed:
    test_ttk_guionly

    ---------------

    With Aqua Carbon Tcl/Tk 8.4.19 (using ActiveState's 8.4.19) on OS X 10.8.5, running test_ttk_guionly (in 32-bit mode):

    =====================================================================
    ERROR: test_class (tkinter.test.test_ttk.test_widgets.ScrollbarTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_ttk/test_widgets.py", line 22, in test_class
        self.assertEqual(widget['class'], '')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1267, in cget
        return self.tk.call(self._w, 'cget', '-' + key)
    _tkinter.TclError: unknown option "-class"

    ======================================================================
    ERROR: test_style (tkinter.test.test_ttk.test_widgets.ScrollbarTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_ttk/test_widgets.py", line 44, in test_style
        self.assertEqual(widget['style'], '')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/__init__.py", line 1267, in cget
        return self.tk.call(self._w, 'cget', '-' + key)
    _tkinter.TclError: unknown option "-style"

    ======================================================================
    FAIL: test_values (tkinter.test.test_ttk.test_widgets.ComboboxTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_ttk/test_widgets.py", line 351, in test_values
        self.assertEqual(self.combo['values'], '')
    AssertionError: () != ''

    ======================================================================
    FAIL: test_borderwidth (tkinter.test.test_ttk.test_widgets.FrameTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 336, in test_borderwidth
        0, 1.3, 2.6, 6, -2, '10p')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '0'> != 0

    ======================================================================
    FAIL: test_height (tkinter.test.test_ttk.test_widgets.FrameTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 556, in test_height
        self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, -100, 0, '3c')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '100'> != 100

    ======================================================================
    FAIL: test_width (tkinter.test.test_ttk.test_widgets.FrameTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 560, in test_width
        self.checkPixelsParam(widget, 'width', 402, 403.4, 404.6, -402, 0, '5i')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '402'> != 402

    ======================================================================
    FAIL: test_borderwidth (tkinter.test.test_ttk.test_widgets.LabelFrameTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 336, in test_borderwidth
        0, 1.3, 2.6, 6, -2, '10p')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '0'> != 0

    ======================================================================
    FAIL: test_height (tkinter.test.test_ttk.test_widgets.LabelFrameTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 556, in test_height
        self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, -100, 0, '3c')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '100'> != 100

    ======================================================================
    FAIL: test_width (tkinter.test.test_ttk.test_widgets.LabelFrameTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 560, in test_width
        self.checkPixelsParam(widget, 'width', 402, 403.4, 404.6, -402, 0, '5i')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '402'> != 402

    ======================================================================
    FAIL: test_wraplength (tkinter.test.test_ttk.test_widgets.LabelTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 493, in test_wraplength
        self.checkParams(widget, 'wraplength', 100)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 186, in checkParams
        self.checkParam(widget, name, value, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '100'> != 100

    ======================================================================
    FAIL: test_length (tkinter.test.test_ttk.test_widgets.ProgressbarTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_ttk/test_widgets.py", line 876, in test_length
        self.checkPixelsParam(widget, 'length', 100.1, 56.7, '2i')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '100.1'> != 100.1

    ======================================================================
    FAIL: test_length (tkinter.test.test_ttk.test_widgets.ScaleTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_ttk/test_widgets.py", line 787, in test_length
        self.checkPixelsParam(widget, 'length', 130, 131.2, 135.6, '5i')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '130'> != 130

    ======================================================================
    FAIL: test_orient (tkinter.test.test_ttk.test_widgets.ScrollbarTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 426, in test_orient
        self.checkEnumParam(widget, 'orient', 'horizontal', 'vertical')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 244, in checkEnumParam
        errmsg='ambiguous' + errmsg2)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 174, in checkInvalidParam
        widget[name] = value
    AssertionError: TclError not raised

    ======================================================================
    FAIL: test_height (tkinter.test.test_ttk.test_widgets.TreeviewTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 556, in test_height
        self.checkPixelsParam(widget, 'height', 100, 101.2, 102.6, -100, 0, '3c')
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 260, in checkPixelsParam
        conv=conv, **kwargs)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 161, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/support.py", line 145, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: <pixel object: '101.2'> != 101.2

    Ran 233 tests in 3.203s

    FAILED (failures=12, errors=2, skipped=1)
    test test_ttk_guionly failed

    @serhiy-storchaka
    Copy link
    Member Author

    Thank you Ned.

    @serhiy-storchaka
    Copy link
    Member Author

    Updated patch fixes issues for Tk 8.4 and skipped ttk.Scrollbar test on MacOSX.

    I have increased the priority because many Tkinter issues will benefit from these tests.

    @serhiy-storchaka
    Copy link
    Member Author

    Updated patch addresses Ezio's comments.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2013

    New changeset 92e268f2719e by Serhiy Storchaka in branch '3.3':
    Issue bpo-19085: Added basic tests for all tkinter widget options.
    http://hg.python.org/cpython/rev/92e268f2719e

    New changeset ab7c2c1d349c by Serhiy Storchaka in branch 'default':
    Issue bpo-19085: Added basic tests for all tkinter widget options.
    http://hg.python.org/cpython/rev/ab7c2c1d349c

    New changeset ced345326151 by Serhiy Storchaka in branch '2.7':
    Issue bpo-19085: Added basic tests for all tkinter widget options.
    http://hg.python.org/cpython/rev/ced345326151

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2013

    New changeset cee56ef59a6a by Serhiy Storchaka in branch 'default':
    Issue bpo-19085. Try to fix tkinter tests on Windows.
    http://hg.python.org/cpython/rev/cee56ef59a6a

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2013

    New changeset 278d15021d9a by Serhiy Storchaka in branch '2.7':
    Issue bpo-19085: Fix Tkinter tests with Tcl/Tk 8.4.
    http://hg.python.org/cpython/rev/278d15021d9a

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 2, 2013

    New changeset f25679db52fb by Serhiy Storchaka in branch '3.3':
    Issue bpo-19085: Fixed some Tkinter tests on Windows.
    http://hg.python.org/cpython/rev/f25679db52fb

    New changeset 4a2afda8f187 by Serhiy Storchaka in branch '2.7':
    Issue bpo-19085: Fixed some Tkinter tests on Windows.
    http://hg.python.org/cpython/rev/4a2afda8f187

    @ned-deily
    Copy link
    Member

    With Cocoa Tk 8.5.15 or Cocoa Tk 8.6.1 on OS X 10.8.5, test_widgets.ButtonTest crashes Tk:

    test_image (tkinter.test.test_tkinter.test_widgets.ButtonTest) ... 2013-11-03 01:52:53.498 pytest_10.8[82465:f07] *** Assertion failure in -[NSBitmapImageRep initWithCGImage:], /SourceCache/AppKit/AppKit-1187.40/AppKit.subproj/NSBitmapImageRep.m:1242
    2013-11-03 01:52:53.499 pytest_10.8[82465:f07] An uncaught exception was raised
    2013-11-03 01:52:53.499 pytest_10.8[82465:f07] Invalid parameter not satisfying: cgImage != NULL
    2013-11-03 01:52:53.502 pytest_10.8[82465:f07] (
    0 CoreFoundation 0x965eae8b __raiseError + 219
    1 libobjc.A.dylib 0x956d152e objc_exception_throw + 230
    2 CoreFoundation 0x9654a698 +[NSException raise:format:arguments:] + 136
    3 Foundation 0x966a5364 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
    4 AppKit 0x98a34525 -[NSBitmapImageRep initWithCGImage:] + 145
    5 Tk 0x00725a48 CreateNSImageWithPixmap + 151
    6 Tk 0x00725b1c TkMacOSXGetNSImageWithTkImage + 149
    7 Tk 0x0071eb2f TkpComputeButtonGeometry + 2550
    8 Tk 0x0069849d TkButtonWorldChanged + 470
    9 Tk 0x00698e99 ConfigureButton + 1981
    10 Tk 0x0069980f ButtonWidgetObjCmd + 440
    11 Tcl 0x00579c2f TclEvalObjvInternal + 770
    12 Tcl 0x0057ac1a Tcl_EvalObjv + 72
    13 _tkinter.so 0x0055db81 Tkapp_Call + 673
    [...]

    With Carbon Tk 8.4.20 on OS X 10.8.5, two test_insertborderwidth failures:

    ======================================================================
    FAIL: test_insertborderwidth (tkinter.test.test_tkinter.test_widgets.EntryTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py", line 327, in test_insertborderwidth
        self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2)
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 158, in checkPixelsParam
        conv=conv1, **kwargs)
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 48, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 32, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: 0 != 1

    ======================================================================
    FAIL: test_insertborderwidth (tkinter.test.test_tkinter.test_widgets.SpinboxTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/test_tkinter/test_widgets.py", line 327, in test_insertborderwidth
        self.checkPixelsParam(widget, 'insertborderwidth', 0, 1.3, -2)
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 158, in checkPixelsParam
        conv=conv1, **kwargs)
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 48, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/py/dev/3x/root/fwd32/Library/Frameworks/pytest_10.8.framework/Versions/3.4/lib/python3.4/tkinter/test/widget_tests.py", line 32, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: 0 != 1

    Ran 536 tests in 1.149s

    FAILED (failures=2, skipped=10)

    @vajrasky
    Copy link
    Mannequin

    vajrasky mannequin commented Nov 3, 2013

    Serhiy,

    In Python3.4, Windows Vista 32 bit, Release Mode, Tcl/Tk 8.5.15, I got a lot of errors. However, if I set _conv_pixels to round in Lib/tkinter/test/widget_tests.py, everything works fine.

    In Python 3.4, Fedora 18, Debug Mode, Tcl/Tk 8.5.13, I got a lot of errors. However, if I set _conv_pixels to round in Lib/tkinter/test/widget_tests.py, I got two errors only.

    ======================================================================
    FAIL: test_insertwidth (main.EntryTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "Lib/tkinter/test/test_tkinter/test_widgets.py", line 335, in test_insertwidth
        self.checkParam(widget, 'insertwidth', 0.9, expected=2)
      File "/home/sky/Code/python/programming_language/cpython/Lib/tkinter/test/widget_tests.py", line 49, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "/home/sky/Code/python/programming_language/cpython/Lib/tkinter/test/widget_tests.py", line 33, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: 1 != 2

    Other error is same.

    Hope that helps!

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 3, 2013

    New changeset a34889a30d52 by Serhiy Storchaka in branch '2.7':
    Issue bpo-19085: Fixed pixels rounding for last Tk patchlevels.
    http://hg.python.org/cpython/rev/a34889a30d52

    New changeset dfdf47a9aad4 by Serhiy Storchaka in branch '3.3':
    Issue bpo-19085: Fixed pixels rounding for last Tk patchlevels.
    http://hg.python.org/cpython/rev/dfdf47a9aad4

    New changeset e7be7aceab77 by Serhiy Storchaka in branch 'default':
    Issue bpo-19085: Fixed pixels rounding for last Tk patchlevels.
    http://hg.python.org/cpython/rev/e7be7aceab77

    @serhiy-storchaka
    Copy link
    Member Author

    Thanks Vajrasky. Now I see that this is a bug in Tk 8.5 which was fixed in 8.5.12. We should use round() to conform with last Tk patchlevels. However this breaks tests on Ubuntu 12.04 LTS which uses 8.5.11.

    Here is a patch which adds workaround for this bug.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 4, 2013

    New changeset c3fa22d04fb2 by Serhiy Storchaka in branch '2.7':
    Issue bpo-19085: Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.12.
    http://hg.python.org/cpython/rev/c3fa22d04fb2

    New changeset 583347b79aa0 by Serhiy Storchaka in branch '3.3':
    Issue bpo-19085: Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.12.
    http://hg.python.org/cpython/rev/583347b79aa0

    New changeset fe5a829bd645 by Serhiy Storchaka in branch 'default':
    Issue bpo-19085: Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.12.
    http://hg.python.org/cpython/rev/fe5a829bd645

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 4, 2013

    New changeset fe7aaf14b129 by Serhiy Storchaka in branch '2.7':
    Issue bpo-19085: Fix running test_ttk_textonly on displayless host.
    http://hg.python.org/cpython/rev/fe7aaf14b129

    New changeset 47d3714dcb33 by Serhiy Storchaka in branch '3.3':
    Issue bpo-19085: Fix running test_ttk_textonly on displayless host.
    http://hg.python.org/cpython/rev/47d3714dcb33

    New changeset 713cc4908a96 by Serhiy Storchaka in branch 'default':
    Issue bpo-19085: Fix running test_ttk_textonly on displayless host.
    http://hg.python.org/cpython/rev/713cc4908a96

    @zware
    Copy link
    Member

    zware commented Nov 5, 2013

    Looks like the last commit broke 8.5.15 on Windows; in particular, on line 25 of widget_tests.py, int_round doesn't exist. Replacing 'int_round' with 'round' allows most tests to pass, but I still get these two failures:

    ======================================================================
    FAIL: test_insertwidth (tkinter.test.test_tkinter.test_widgets.EntryTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\test_tkinter\test_widget
    s.py", line 336, in test_insertwidth
        self.checkParam(widget, 'insertwidth', 0.9, expected=2)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 6
    6, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 5
    0, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: 1 != 2

    ======================================================================
    FAIL: test_insertwidth (tkinter.test.test_tkinter.test_widgets.SpinboxTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\test_tkinter\test_widget
    s.py", line 336, in test_insertwidth
        self.checkParam(widget, 'insertwidth', 0.9, expected=2)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 6
    6, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 5
    0, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: 1 != 2

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 5, 2013

    New changeset d5d0356ba5ac by Serhiy Storchaka in branch '3.3':
    Fix typo in tkinter tests (issue bpo-19085).
    http://hg.python.org/cpython/rev/d5d0356ba5ac

    New changeset fc4ef17c7db8 by Serhiy Storchaka in branch 'default':
    Fix typo in tkinter tests (issue bpo-19085).
    http://hg.python.org/cpython/rev/fc4ef17c7db8

    @serhiy-storchaka
    Copy link
    Member Author

    Thank you Zachary.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 5, 2013

    New changeset eb126f976fa2 by Serhiy Storchaka in branch '2.7':
    Fix test_insertwidth Tkinter tests on Tk 8.5 with patchlevel >= 8.5.12 (issue bpo-19085).
    http://hg.python.org/cpython/rev/eb126f976fa2

    New changeset 21fbe3ec90dc by Serhiy Storchaka in branch '3.3':
    Fix test_insertwidth Tkinter tests on Tk 8.5 with patchlevel >= 8.5.12 (issue bpo-19085).
    http://hg.python.org/cpython/rev/21fbe3ec90dc

    New changeset ce08158e3f6c by Serhiy Storchaka in branch 'default':
    Fix test_insertwidth Tkinter tests on Tk 8.5 with patchlevel >= 8.5.12 (issue bpo-19085).
    http://hg.python.org/cpython/rev/ce08158e3f6c

    @zware
    Copy link
    Member

    zware commented Nov 5, 2013

    Working from ce08158e3f6c with 8.5.15 on Windows, I get the same failures with a different AssertionError:

    ======================================================================
    FAIL: test_insertwidth (tkinter.test.test_tkinter.test_widgets.EntryTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\test_tkinter\test_widget
    s.py", line 340, in test_insertwidth
        self.checkParam(widget, 'insertwidth', 0.9)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 6
    6, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 5
    0, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: 1 != 0.9

    ======================================================================
    FAIL: test_insertwidth (tkinter.test.test_tkinter.test_widgets.SpinboxTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\test_tkinter\test_widget
    s.py", line 340, in test_insertwidth
        self.checkParam(widget, 'insertwidth', 0.9)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 6
    6, in checkParam
        self.assertEqual2(widget[name], expected, eq=eq)
      File "P:\Projects\OSS\Python\cpython\lib\tkinter\test\widget_tests.py", line 5
    0, in assertEqual2
        self.assertEqual(actual, expected, msg)
    AssertionError: 1 != 0.9

    By the way, thank you for all the work you're doing on this, Serhiy!

    @zware
    Copy link
    Member

    zware commented Nov 5, 2013

    FTR, both 8.5.11 and 8.6.1 pass all tests on Windows from ce08158e3f6c (with unrelated modifications required to build and use 8.6.1).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 5, 2013

    New changeset c97600bdd726 by Serhiy Storchaka in branch '2.7':
    Revert wrong change in previous commit (issue bpo-19085).
    http://hg.python.org/cpython/rev/c97600bdd726

    New changeset bec6df56c053 by Serhiy Storchaka in branch '3.3':
    Revert wrong change in previous commit (issue bpo-19085).
    http://hg.python.org/cpython/rev/bec6df56c053

    New changeset 545feebd58fb by Serhiy Storchaka in branch 'default':
    Revert wrong change in previous commit (issue bpo-19085).
    http://hg.python.org/cpython/rev/545feebd58fb

    @serhiy-storchaka
    Copy link
    Member Author

    My fault. I missed that here is simple checkParam() instead of checkPixelsParam(). Thank you Zachary.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 9, 2013

    New changeset be8f9beca8aa by Serhiy Storchaka in branch '2.7':
    Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.11 (issue bpo-19085).
    http://hg.python.org/cpython/rev/be8f9beca8aa

    New changeset 204e66190dbb by Serhiy Storchaka in branch '3.3':
    Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.11 (issue bpo-19085).
    http://hg.python.org/cpython/rev/204e66190dbb

    New changeset 2834e410d1ae by Serhiy Storchaka in branch 'default':
    Fix Tkinter tests on Tk 8.5 with patchlevel < 8.5.11 (issue bpo-19085).
    http://hg.python.org/cpython/rev/2834e410d1ae

    @ned-deily
    Copy link
    Member

    test_widgets.ButtonTest is still causing a Cocoa Tk 8.5/8.6 crash which also crashes Python while running the test suite. The test should be fixed or disabled.

    @serhiy-storchaka
    Copy link
    Member Author

    Crashes? It should be separate issue, no one Tkinter operation shouldn't crash Python.

    Fill free to disable this tests on MacOSX (or better on more specific environment) if they prevent the test suite from running.

    @ned-deily
    Copy link
    Member

    See msg202006 above.

    @serhiy-storchaka
    Copy link
    Member Author

    test_widgets.ButtonTest is still causing a Cocoa Tk 8.5/8.6 crash which also
    crashes Python while running the test suite. The test should be fixed or
    disabled.

    Opened bpo-19733 for this.

    @ned-deily
    Copy link
    Member

    I've opened bpo-19761 to document the current state of test failures for 3.4.0b1 on OS X with the native Tk 8.5 and 8.4.

    @zware
    Copy link
    Member

    zware commented Feb 27, 2014

    What's the status here? Appears to be fixed?

    @ned-deily
    Copy link
    Member

    All of the failures I reported are now fixed so I think this issue can be closed.

    @serhiy-storchaka
    Copy link
    Member Author

    Thank you Net, Vajrasky and Zachary for your help for testing.

    @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-tkinter type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants