[issue18279] IDLE Unit test for RstripExtension.py

2013-07-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Trying it out, I rediscovered that patchcheck has a Windows bug. This time I 
reported it ;-) #18439.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ec71fcdcfeac by Terry Jan Reedy in branch '2.7':
Issue #18279: Add tests for idlelib/RstripExtension.py. Original patch by
http://hg.python.org/cpython/rev/ec71fcdcfeac

New changeset 22ce68d98345 by Terry Jan Reedy in branch '3.3':
Issue #18279: Add tests for idlelib/RstripExtension.py. Original patch by
http://hg.python.org/cpython/rev/22ce68d98345

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I had to remove the dependency to close this, since the test_text issue #18365 
was reopened.

--
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A simple change to RstripExtension.py fixed the marking of unchanged files as 
changed. I also removed a useless extra iteration. Having a test makes it 
possible to do things like this without breaking what already worked.

--
dependencies:  -Idle: mock Text class and test thereof
resolution:  - fixed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Phil (and everyone else): PLEASE submit patches with 4 space indents and no 
tabs and no trailing spaces. Even if the code below runs in the CPython 
interpreter,

self.undo = mockUndoDelegator() 8 spaces
4 spaces
def get_selection_indices(self): 4 spaces
first = self.text.index('1.0') 4 spaces, 1 tab 

class mockUndoDelegator:
def undo_block_start(*args): 1 tab
pass  2 tabs

the CPython repository whitespace pre-commit will say this:

remote:  - file Lib/idlelib/idle_test/test_text.py is not whitespace-normalized 
in 979905090779
remote: * Run Tools/scripts/reindent.py on .py files or Tools/scripts 
/reindent-rst.py on .rst files listed above
remote: * and commit that change before pushing to this repo.
remote: transaction abort!
remote: rollback completed

as happened with the mock_tk/test_text patch. I already fixed this file, but 
next time...

About no trailing whitespace: that is not an option when committing, so I will 
change the string literal to use explicit \n and implicit catenation, as in 'ab 
 \n' 'cd\n' == 'ab  \ncd\n'. This will make the trailing ws visible anyway.

The way to not get the tk=added \n is to use 'insert' rather than 'end', as 
inself.text.get('1.0','insert'). 'Insert' is the end of user input, before the 
guard.

Will commit patch soon.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-12 Thread Todd Rovito

Todd Rovito added the comment:

As a suggestion I always use the command make patchcheck (before making the 
patch) which catches the white space and tab problem plus it fixes other 
things.  Here is more information on patch check in the developer's guide.

http://docs.python.org/devguide/committing.html#patch-checklist

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am aware of patchcheck, but the problem for me is that 'make patchcheck' does 
not work on Windows; the doc is wrong on the awkward to type Windows 
alternative; and it is usually useless anyway. But I agree that anyone who does 
not use a editor configured to automatically converts tabs to 4 spaces, as are 
both Idle and Notepad++ here, should run reindent.py.

When I learn how to write extensions, maybe I will work on one to run or 
imitate patchcheck, and offer to open Acks and News for editing if not in the 
changeset.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-07 Thread Phil Webster

Phil Webster added the comment:

This patch contains mock_idle.py and the rstrip test using the mock text widget 
from #18365.

Terry- For some reason, the Text widget always contains a '\n' as the last 
character even when there is nothing visible. Doing a text.get('1.0','end') 
always has a '\n' at the end from what I can tell. I'm not sure about the 
filename changing, is it worth creating a new issue for?

--
Added file: http://bugs.python.org/file30852/test_rstrip3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-05 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I decided that the first commit should be a separate issue that this issue 
depends on.

--
assignee:  - terry.reedy
dependencies: +Idle: mock Text class and test thereof

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-04 Thread Phil Webster

Phil Webster added the comment:

Added to Terry's Text Widget code (in #18226) and created mock_idle.py for the 
mock EditorWindow. Todd's FormatParagraph test in the aforementioned issue also 
passes with the mock EditorWindow.

--
Added file: http://bugs.python.org/file30777/test_rstrip2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-07-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I want to make two separate commits. First add mock Text into mock_tk.py, and 
add a new test_text.py. I suggested looking at the tkinter Text test. I turns 
out that it only tests a few special search cases. I am guessing that they have 
something to do with the tkinter interface. If neither you nor Todd feel like 
writing the Text test, I will. Let me know either way.

Second, add the new mock_idle and test_rstrip files. For the latter, at least 
one line should have no whitespace, and one should have an indent. With an 
indent, the test would fail if rstrip in the tested file were changed to strip.

In the tearDown method, the apparent purpose of
self.rstripextension = None
is to actually do
del self.rstripextension
and that happens automatically when self disappears.
With a mock editor window, there is no need for root.destroy and hence for 
the close call, and hence for the tearDown method.

With only one test method, the setUp lines can be part of the test. For the 
attribute names, I strongly prefer 'rstrip' to 'rstripExtension' and 'editor' 
to 'mockEditorWindow'.

I am curious about this comment:
# Note: Tkinter always adds a newline at the end of the text widget,
# hence the newline in the expected_text string

In live Idle, I tried 'strip trailing whitespace' with text that did not end 
with \n and there was none visible after.

An annoyance is that after stripping  the filename is prefixed with * to 
indicate that it has been changed and needs to be changed, even when it has not 
(or should not have been). Closing brings up the unnecessary 'Changed, save?' 
box. Is this related to the comment?

--
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-24 Thread Phil Webster

Phil Webster added the comment:

Modified the first patch to get rid of mock EditorWindow in favor of the real 
thing. Also renamed the test to 'test_rstrip'.

--
Added file: http://bugs.python.org/file30694/test_rstrip.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-21 Thread Phil Webster

New submission from Phil Webster:

This is a single test for RstripExtension.py, following from #15392. I also 
added a mock EditorWindow module with a Text widget for testing. 
test_rstripextension.py seems to run fine inside IDLE and produces the 
following output:

 
test_do_rstrip (__main__.Test_rstripextension) ... ok

--
Ran 1 test in 0.100s

OK

However, when I run via the command line, I get the following output:

philwebster@ubuntu:~/Dev/cpython$ ./python -m test -ugui test_idle
[1/1] test_idle
Warning -- warnings.showwarning was modified by test_idle
1 test altered the execution environment:
test_idle

I attempted to replicate the results from #18189, but saw the same message. Any 
thoughts?

--
components: IDLE
messages: 191618
nosy: JayKrish, philwebster
priority: normal
severity: normal
status: open
title: IDLE Unit test for RstripExtension.py
type: enhancement
versions: Python 2.7, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-21 Thread Phil Webster

Changes by Phil Webster webster.p...@gmail.com:


--
nosy: +Todd.Rovito

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-21 Thread Phil Webster

Changes by Phil Webster webster.p...@gmail.com:


--
nosy: +terry.reedy

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-21 Thread Phil Webster

Changes by Phil Webster webster.p...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file30664/test_rstripext.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-21 Thread Terry J. Reedy

Terry J. Reedy added the comment:

There is a separate issue about killing that warning.

If you leave off '-ugui', you will see the traceback and why I said that 
requires('gui') should be wrapped for unittest discovery. As the code is, the 
call is executed when the file is imported, possibly during discovery, before 
the  unittest or regrtest runner starts running tests and counting success, 
fail, skip.

Two other thoughts before I look as rstrip and the content of the new test 
file. 

I would like to just call it test_rstrip. 

I have thought of having just one mock_idle.py for mock Idle classes (as 
opposed to mock_tk with mock tk classes. I am not sure how many will will need. 
Since your mock_ewin uses a real tk.Text widget, hence requiring gui, what is 
its purpose? The point of the mock_tk classes is to avoid gui and make the test 
text only. I am not saying that this is the only purpose, but other purposes 
should be stated and documented.

--
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-21 Thread Phil Webster

Phil Webster added the comment:

Thank you for the feedback Terry. I'm not seeing the traceback without '-ugui' 
either, so I'm going to look into that. I get the same results with 
requires('gui') moved inside of setUp, is that what you mean by wrapping?

For mock_ewin I used a real Text widget because RstripExtension uses index(), 
get(), and delete() and I was not able to figure out how the widget implemented 
these (is there a single string with the contents?). I can work on a non-gui 
test though if that's what needs to be done.

Thanks!

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18279
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com