-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
Idle: improve idle_test.htest #65676
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
Comments
bpo-18104 created idle_test/htest.py. Besides adding more tests in other issues, some possible improvements to htest itself follow. Many depend on not reusing run, as it now it, in the runall loop. What is left in common to both might be factored out.
|
New changeset 33a39dfc239e by Terry Jan Reedy in branch '2.7': New changeset 7c70198ec48e by Terry Jan Reedy in branch '3.4': |
Adds spec dicts for aboutDialog, ClassBrowser, PathBrowser, textView and configHelpSourceEdit and modifies the related modules appropriately. The tests work OK when run individually from respective modules. The widgets are placed below parent. Some widgets close the parent when they are closed, some do not.(I feel the parent should be manually closed by the user, because the user might want to re-run a test. This would also help in reusing root, when running all the tests together). The runall() seems shaky at the moment. For eg, as mentioned above, some widgets close the parent when they are closed, some do not. This is causes build-up of parent dialogs. I did not try to fix it, because things will change once we agree upon factoring out run() and runall(), about reusing the same root window for runall(). If things dont change, I will work on fixing the buildup of dialogs. If this patch seems "incomplete" because of the above issue, please provide feedback about the tests itself, when run individually. |
Posting a cumulative patch of all htest written so far. They include IOBinding, Tooltips, MultiStatusbar, tabbedpages, objectbrowser, *Improving run/runall - (run-runall.diff) The logic behind it is contained in line 206 to line 223 of htest.py when run-runall.diff is applied. If this approach is desired, please say so. I will work on improving the responsiveness of the root window(Constant size of root dialog, ensuring buttons, labels etc stay in the "same place" and dont "jump" around). |
run-runall.diff import cleanly to 3.4. Running all the tests works well enough that I am applying this, with minor changes, to be a base for further patches. Good job. The few problems I fixed:
Things to do starting from this.
|
Since I wanted to get this large patch applied as a basis for further work, I went ahead with the 2.7 backport. I am listing the issues in converting run-runall-34.diff to run-runall-27.diff to help Saimadhav do this in the future.
(Note: some time ago, I converted all open statements to 'with open' in 2.7 and 3.x. I did not think of 'file(' as a synonym for 'open('. Any other uses of 'file(' should be converted also.)
|
New changeset ece24bcd1a6f by Terry Jan Reedy in branch '2.7': New changeset 038cbbef4539 by Terry Jan Reedy in branch '3.4': |
I just discovered today that Rietveld can do diffs between diffs, so to speak. For example, |
Modifications in htest-25052014.diff
When this diff(subject to passing review and feedback) is pushed, I will make a corresponding patch for 2.7 |
New changeset d7eea8f608c2 by Terry Jan Reedy in branch '3.4': |
The format paragragh methods and functions are well tested, better than a human will, in the current test_formatgraph unittest. I removed this part of the patch. (But see 5. below about moving it.) When I wrote the notes that became htest.txt, a year ago, I had not written any tests other than for calltips. I listed almost all the files that had existig tests. So don't add new tests not mentioned in htest.txt without discussion. And question the existing and proposed tests listed there. For instance, I presume we can use the Text.tag_methods to write an automated ColorDelegator test that checks that tagged words are as expected and that colors match the configured values. We can leave the current test (with patch), until replaced.
Exception in Tkinter callback
Traceback (most recent call last):
File "F:\Python\dev\4\py34\lib\idlelib\run.py", line 121, in main
seq, request = rpc.request_queue.get(block=True, timeout=0.05)
File "F:\Python\dev\4\py34\lib\queue.py", line 175, in get
raise Empty
queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "F:\Python\dev\4\py34\lib\tkinter\__init__.py", line 1487, in __call__
return self.func(*args)
File "F:\Python\dev\4\py34\lib\idlelib\TreeWidget.py", line 122, in flip
self.item.OnDoubleClick()
File "F:\Python\dev\4\py34\Lib\idlelib\ClassBrowser.py", line 174, in OnDoubleClick
edit = PyShell.flist.open(self.file)
AttributeError: 'module' object has no attribute 'flist' or with just the AttributeError. Unless and until we can suppress the traceback, the message should be changed from 'not work' to 'will print a traceback for an exception that is ignored'. [done]
def run(*tests, *, test_list=None):
if test_list is None: test_list = [] Add htour.py (for instance) with a callable and spec for non-htested classes (and behaviors). It could begin like this from idlelib.idle_test.htest import run
def _format_paragraph(parent): ...(such as in current patch) _format_paragraph_spec = ...(such as in current patch) tour_list = [(_format_paragraph, _format_paragraph_spec),]
# automate by scanning globals for callables and grabbing matching specs
run(test_list=tour_list) This should be a separate issue that follows on this one. If you feel like expanding the above to a preliminary patch, go ahead.
|
Yes, remove unscrollable (test2) tree widget (review response). |
Summary for htest-26052014-34.diff and htest-26052014-27.diff
The corresponding 27 patch is to be applied on top of htest-25052014-27.diff. Apart,
and, in the "next()" in run(): To make things more readable, we could perhaps change the 'root' in run() to 'parent' and ensure consistency.
|
"2. Htest's for GrepDialog, outputwindow, configDialog and Filelist are not progressing because of assert statements in macosxsupport.py." The asserts are to ensure that none of the Tk-variant tests (isCarbonTk(), isCocoaTk(), et al) are called before _initializeTkVariantTests(root) has been called. And _initializeTkVariantTests can only be called after the initial calls to Tk have been made to create an initial window environment; it's only at that point that we can call Tk to enquire what variant of Tk we are running under (macosxSupport.py:28 and 33). _initializeTkVariantTests is called from macosxSupport.setupApp which is called from PyShell.main. This is fine for normal IDLE startup but it doesn't take into account the module level tests. Ideally, you do want to have run _initializeTkVariantTests before running GUI tests so that the behavior is properly conditioned on Tk variant type, so stubbing out the Tk type with macosxsupport._tk_type = "other' is not desirable. Perhaps the best way to deal with it is to create a common GUI test initialization function that is called by all of the GUI tests; the initialization function would be responsible for creating the Tk() root, calling _initializeTkVariantTests, and any other common steps that might arise. |
New changeset 72a8a107eed1 by Terry Jan Reedy in branch '2.7': |
New changeset e770d8c4291c by Terry Jan Reedy in branch '2.7': New changeset b8e4bb1e1090 by Terry Jan Reedy in branch '3.4': |
I think it time to make running through all or just some of the tests more pleasant. If we reversed the order [next], [test name], test instruction, then [next] would not just up and down. If the window were set to a constant width, then it would not jump back and forth either. The width should be just wide enough for the longest lines we use in htest.py, or can we just allow them to wrap? To select just a one or a few tests (like just Search, Replace, and Tree for the 2605.. patch), a drop down list box would be nice. It could be beside the next box. With a constant width, there would be room. Doing the test reminded me that Search (find) and Replace have a severe bug on Windows of not highlighting the the found text while the box is still open. There was an issue where this was supposedly fixed, but it is not. Find is usable by closing the box and using cntl-G for find next. But this does not work for replace, making replace useless on windows unless one is really sure about replace all. |
Ned, I recently saw that some of the builtin extensions call macosxsupport. I though then that it would be better if such calls were somehow handled automatically. I have no idea how and when to make them and so I don't know if the existing calls are needed or if other calls should be added. So I like your idea. It seems like it should be a separate issue. |
Summary for
With this, it leaves AutoCompleteWindow, TkMessageBoxes, Debugger(from 21477-htest.txt) to be tested. OutputWindow - already being tested from GrepDialog. There is nothing extra to be tested separately. FileList - Is it already being tested through EditorWindow? RemoteDebugger and RemoteObjectBrowser - I need some input on how to begin with them. Next: Apart from the above htest, a way to destroy the child when user clicks 'next', for certain modules like ClassBrowser, which don't work by the method of http://bugs.python.org/msg219161 |
New changeset 90dab7696e89 by Terry Jan Reedy in branch '2.7': New changeset d90905960803 by Terry Jan Reedy in branch '3.4': |
Ned, this patch includes a call to macosxSupport. _initializeTkVariantTests(root) in htest.run. Does this work on mac or is something else needed (like doing the same for individual tests that create another root)? |
New changeset 334b6725b2f7 by Terry Jan Reedy in branch '2.7': New changeset e56c3585ea80 by Terry Jan Reedy in branch '3.4': |
I regard the goal of this issue as having been accomplished. I opened bpo-21624 for any further work on htests. |
"this patch includes a call to macosxSupport. _initializeTkVariantTests(root) in htest.run. Does this work on mac or is something else needed (like doing the same for individual tests that create another root)?" That looks good and, in a quick spot check running a few tests, seems to work fine. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: