8000 bpo-1529353: IDLE: squeeze large output in the shell by taleinat · Pull Request #7626 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-1529353: IDLE: squeeze large output in the shell #7626

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

Merged
merged 19 commits into from
Sep 25, 2018
Merged
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
a7e130a
bpo-1529353: update the Squeezer extension and its tests
taleinat Jun 11, 2018
0af6a62
bpo-1529353: use idlelib.textview for previewing squeezed output
taleinat Aug 12, 2018
71fb2c1
Merge branch 'master' into bpo-1529353
taleinat Aug 12, 2018
bda6572
Refactor Squeezer from an extension to an integral part of IDLE.
taleinat Aug 13, 2018
53e74d9
Merge branch 'master' into bpo-1529353
taleinat Aug 27, 2018
902091e
Update Squeezer's tests given the latest changes
taleinat Aug 27, 2018
6d7035b
add ability to control text wrapping in IDLE's text viewer
taleinat Aug 28, 2018
45fb1a6
ask for user confirmation before expanding huge squeezed outputs
taleinat Aug 28, 2018
18106e8
increase Squeezer's default auto-squeeze-min-lines from 30 to 50
taleinat Aug 28, 2018
2c795e3
move 'copy' and 'preview' squeezed output actions to a context menu
taleinat Aug 28, 2018
1a1288a
Squeezer: rename "preview" to "view"
taleinat Aug 28, 2018
f753b37
Squeezer: remove tooltip configuration options (delay set to 80ms)
taleinat Aug 30, 2018
6087d3f
Squeezer: remove expand/view-last-squeezed events
taleinat Aug 30, 2018
b7d27cb
Squeezer: make view window non-modal and add horizontal scrollbar
taleinat Aug 30, 2018
ce07987
Merge remote-tracking branch 'origin/master' into pr_7626.
terryjreedy Sep 25, 2018
9676991
Correct error in merge resolution.
terryjreedy Sep 25, 2018
e768e0f
Make test_squeezer runnable.
terryjreedy Sep 25, 2018
fcc9084
bpo-1529353: explicitly create root Tk() objects in tests
taleinat Sep 25, 2018
468d9ec
bpo-1529353: reformat doc-strings as PEP8 and rename test classes
taleinat Sep 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
bpo-1529353: explicitly create root Tk() objects in tests
  • Loading branch information
taleinat committed Sep 25, 2018
commit fcc9084f3876693b02947e36db8bfdebc5f4e33d
38 changes: 26 additions & 12 deletions Lib/idlelib/idle_test/test_squeezer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections import namedtuple
from tkinter import Text
from tkinter import Text, Tk
import unittest
from unittest.mock import Mock, NonCallableMagicMock, patch, sentinel, ANY
from test.support import requires
Expand All @@ -16,6 +16,20 @@
SENTINEL_VALUE = sentinel.SENTINEL_VALUE


def get_test_tk_root(test_instance):
"""helper for tests: create a root Tk object"""
requires('gui')
root = Tk()
root.withdraw()

def cleanup_root():
root.update_idletasks()
root.destroy()
test_instance.addCleanup(cleanup_root)

return root


class TestCountLines(unittest.TestCase):
"""tests for the count_lines_with_wrapping function"""
def check(self, expected, text, linewidth, tabwidth):
Expand Down Expand Up @@ -195,8 +209,8 @@ def test_write_stdout(self):

def test_auto_squeeze(self):
"""test that the auto-squeezing creates an ExpandingButton properly"""
requires('gui')
text_widget = Text()
root = get_test_tk_root(self)
text_widget = Text(root)
text_widget.mark_set("iomark", "1.0")

editwin = self.make_mock_editor_window()
Expand All @@ -211,11 +225,11 @@ def test_auto_squeeze(self):

def test_squeeze_current_text_event(self):
"""test the squeeze_current_text event"""
requires('gui')
root = get_test_tk_root(self)

# squeezing text should work for both stdout and stderr
for tag_name in "stdout", "stderr":
text_widget = Text()
for tag_name in ["stdout", "stderr"]:
text_widget = Text(root)
text_widget.mark_set("iomark", "1.0")

editwin = self.make_mock_editor_window()
Expand Down Expand Up @@ -245,9 +259,9 @@ def test_squeeze_current_text_event(self):

def test_squeeze_current_text_event_no_allowed_tags(self):
"""test that the event doesn't squeeze text without a relevant tag"""
requires('gui')
root = get_test_tk_root(self)

text_widget = Text()
text_widget = Text(root)
text_widget.mark_set("iomark", "1.0")

editwin = self.make_mock_editor_window()
Expand All @@ -270,9 +284,9 @@ def test_squeeze_current_text_event_no_allowed_tags(self):

def test_squeeze_text_before_existing_squeezed_text(self):
"""test squeezing text before existing squeezed text"""
requires('gui')
root = get_test_tk_root(self)

text_widget = Text()
text_widget = Text(root)
text_widget.mark_set("iomark", "1.0")

editwin = self.make_mock_editor_window()
Expand Down Expand Up @@ -328,9 +342,9 @@ class TestExpandingButton(unittest.TestCase):
# Text and Button instances are created.
def make_mock_squeezer(self):
"""helper for tests"""
requires('gui')
root = get_test_tk_root(self)
squeezer = Mock()
squeezer.editwin.text = Text()
squeezer.editwin.text = Text(root)

# Set default values for the configuration settings
squeezer.auto_squeeze_min_lines = 50
Expand Down
0