Skip to content

bpo-31003: IDLE - Add more tests for General tab #2859

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 11 commits into from
Jul 27, 2017

Conversation

terryjreedy
Copy link
Member

@terryjreedy terryjreedy commented Jul 25, 2017

@terryjreedy terryjreedy changed the title Helper bpo-31003: IDLE - Add more tests for General tab Jul 25, 2017
@terryjreedy
Copy link
Member Author

WIP: Preparation, now ready to add tests. Each chunk is a coherent diff, and I will try to continue that way.

@terryjreedy
Copy link
Member Author

I think this is complete.

Copy link
Contributor

@mlouielu mlouielu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't looked deeply to test code, the test pass on Linux.

I have some comment for configdialog.py, some place should be more clarify.

helplist_item_remove: Command for button_helplist_remove.
update_user_help_changed_items: Fill in changes.
Enable users to provisionally change general options.
Load_general_cfg loads current values. Radiobuttons
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Load_general_cfg -> load_general_cfg

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about "loads current settings" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added 'Function' to sentence in FontTab docstring and copied the form here: "Function load_general_cfg intializes tk variables and helplist using idleConf."

update_user_help_changed_items: Fill in changes.
Enable users to provisionally change general options.
Load_general_cfg loads current values. Radiobuttons
startup_shell_on and startup_editor_on set var startup_edit.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO the tk_var should add startup_edit (backtick), otherwise I found that is hard to read the comment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used 'sets var x_y' in the FontTab docstring. I tried Var instead of var. We could use 'tk variable' to be really explicit, but I was hoping 'var' or 'Var' as an abbreviation (StringVar, IntVar, etc) would be clear enough. I am going to push as is, but we can revisit this in 'extract class' issues where function docstring become class docstring. bpo-31004, bpo-31050

startup_shell_on and startup_editor_on set var startup_edit.
Radiobuttons save_ask_on and save_auto_on set var autosave.
Entry boxes win_width_int and win_height_int set var win_width
and win_height. Setting vars invokes var_changed_var_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var_changed_varname (e.g. startup_edit -> var_changed_startup_edit)

Copy link
Member Author

@terryjreedy terryjreedy Jul 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to "Setting var_name invokes the var_changed_var_name callback...", which I hope is clearer.

"Load current configuration settings for the general options."
# Set startup state.
self.startup_edit.set(idleConf.GetOption(
'main', 'General', 'editor-on-startup', default=0, type='bool'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default=0 was changed (previous is default=1), does this change right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default is only needed if config-main.def is corrupted, which should be never. The win size calls do not give a default. config-main.def currently has 0 and default in call, if given, should be same.

@@ -29,6 +31,8 @@ def __call__(self, *args, **kwds):
self.kwds = kwds
if isinstance(self.result, BaseException):
raise self.result
elif self.return_self:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this need to suppress when isinstance(self.result, BaseException) is True?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what 'suppression' you are proposing, but I really want to be able to raise any exception. Calltip tests should include one with eval mocked with Func(BaseException) to raise BaseException. (see code).

(*)radio_startup_edit: Radiobutton - startup_edit
(*)radio_startup_shell: Radiobutton - startup_edit
(*)startup_editor_on: Radiobutton - startup_edit
(*)startup_shell_on: Radiobutton - startup_edit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is trivial, but with the rename (and since this is moving to its own class soon), I had been thinking about the variable being startup_window and then the two choices just being shell and editor.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we were starting fresh..., but we are not. We cannot change config-main.def.
[General]
editor-on-startup= 0
This is read as a boolean, and startup_editor should be BooleanVar, not IntVar.

What we show users When tests are merged, we can review code and layout. I intend to remove three top frame and change to:

Window to open at startup: O Shell O Editor
Initial size: Width [_] Height []
When run code in editor: ... (see bpo-19042 for possible change)

(*)radio_save_ask: Radiobutton - autosave
(*)radio_save_auto: Radiobutton - autosave
(*)save_ask_on: Radiobutton - autosave
(*)save_auto_on: Radiobutton - autosave
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here as above, I was hoping to simplify the names to autosave and the choices to prompt and noprompt.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this issue, I focused on the names I knew would be most used in tests. We can continue changes in bpo-31050 or bpo-31051.

@@ -735,16 +737,16 @@ def create_page_general(self):
win_height_title = Label(frame_win_size, text='Height')
self.entry_win_height = Entry(
frame_win_size, textvariable=self.win_height, width=3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You changed entry_win_height and entry_win_width in the comment, but not the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the issue mentioned on the ticket, would this help for validating the entry widget?
https://stackoverflow.com/questions/4140437/interactively-validating-entry-widget-content-in-tkinter#4140988

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See new comment on bpo-31051.

self.list_help.bind('<ButtonRelease-1>', self.help_source_selected)
scroll_helplist = Scrollbar(frame_helplist)
scroll_helplist.config(command=self.helplist.yview)
self.helplist.config(yscrollcommand=scroll_helplist.set)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to change config like you did for 'state'?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

for num in range(1, len(self.user_helplist) + 1):
changes.add_option(
'main', 'HelpFiles', str(num),
';'.join(self.user_helplist[num-1][:2]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a good time to change it to for num, item in enumerate(self.user_helplist, 1): and the last line to .join(item[:2])?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in code and text, matching comment. (CSabella comment).

Test that widget actions set vars, that var changes add three
options to changes and call set_samples, and that set_samples
changes the font of both sample boxes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Too much text from Font test.

@terryjreedy terryjreedy merged commit 2bc8f0e into python:master Jul 27, 2017
@terryjreedy terryjreedy deleted the helper branch July 27, 2017 00:54
terryjreedy added a commit to terryjreedy/cpython that referenced this pull request Jul 27, 2017
* In configdialog: Document causal pathways in create_page_general.
Move related functions to follow this. Simplify some attribute names.
* In test_configdialog: Add tests for load and helplist functions.
Coverage for the general tab is now complete, and 63% overall.
(cherry picked from commit 2bc8f0e)
terryjreedy added a commit that referenced this pull request Jul 27, 2017
* In configdialog: Document causal pathways in create_page_general.
Move related functions to follow this. Simplify some attribute names.
* In test_configdialog: Add tests for load and helplist functions.
Coverage for the general tab is now complete, and 63% overall.
(cherry picked from commit 2bc8f0e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants