This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年08月04日 17:52 by anton.barkovsky, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| test_webbrowser.patch | anton.barkovsky, 2012年08月04日 17:52 | review | ||
| test_webbrowser_v2.patch | anton.barkovsky, 2012年08月12日 14:34 | review | ||
| test_webbrowser_v3.patch | anton.barkovsky, 2012年08月12日 19:09 | review | ||
| test_webbrowser.patch | r.david.murray, 2012年09月03日 02:45 | review | ||
| test_webbrowser.patch | r.david.murray, 2012年09月03日 15:00 | review | ||
| Messages (18) | |||
|---|---|---|---|
| msg167423 - (view) | Author: Anton Barkovsky (anton.barkovsky) * | Date: 2012年08月04日 17:52 | |
Attaching a patch with some tests for webbrowser module. The tests fail unless #15509 is fixed. They also print lots of warnings unless #15447 is fixed. |
|||
| msg167983 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年08月11日 17:43 | |
It seems like these tests can be made more DRY. For example, the line `args = popen.cmd_line` appears in every test. You could make an assert_args() helper method to address this. There also seems to be a lot of overlap between tests for each browser. A DRY approach would let one see more easily how the tests differ across browsers. Do you also need to include the test boilerplate at the bottom? See, for example-- http://hg.python.org/cpython/file/867de88b69f0/Lib/test/test_textwrap.py#l732 |
|||
| msg168020 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年08月12日 04:36 | |
Regrtest has evolved. For new test files (ie: 3.3 and later) the preferred (at least by me :) idiom now is just: if __name__ == '__main__': unittest.main() Everything else is now automatic, using the unittest machinery. For an example, see test_smptd. |
|||
| msg168041 - (view) | Author: Anton Barkovsky (anton.barkovsky) * | Date: 2012年08月12日 14:34 | |
Thanks for the review, I've updated the patch. |
|||
| msg168052 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年08月12日 16:30 | |
It still seems like things could be made more DRY. Also, the pattern of having assert_unix_browser() execute various function blocks depending on whether various arguments are not None doesn't seem as clean or scalable as it should be (e.g. if the number of assert statements were to grow).
What about defining helper methods like check_open(), check_open_new_tab(), and check_open_new(), and then having the various test_<browser>() methods call each of them as appropriate? For example--
+ browser.open_new('http://www.example.com/')
+ args = popen.cmd_line
+ self.assertEqual(args, ['test', '-raise', '-remote',
+ 'openURL(http://www.example.com/,new-window)'])
could become a call to check_open_new(). The helper methods could default to the most common string arguments so that you will only need to define and pass the string arguments when the browser uses strings that are different from the defaults.
|
|||
| msg168060 - (view) | Author: Anton Barkovsky (anton.barkovsky) * | Date: 2012年08月12日 19:09 | |
Updated, added separate helper methods and 'test' and 'http://www.example.com/' are no longer hardcoded. > The helper methods could default to the most common string arguments so that you will only need to define and pass the string arguments when the browser uses strings that are different from the defaults. I don't see a good reason to provide defaults. If some browsers have same arguments it's just a coincidence, the arguments are not likely to ever change, and I don't like when a test case is scattered all over the module in the form of defaults. |
|||
| msg168064 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年08月12日 19:56 | |
Thanks, Anton. It is looking a lot better now. I still have comments, but because my comments have not been on the substance of the patch and because I am not a core developer, I will defer to others at this point. |
|||
| msg169738 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月03日 02:45 | |
Thanks, Anton. I took your last patch just a bit further, mostly to make it easy to break up the test methods that test multiple things into test methods that test just one thing. I also made the test insensitive to the order of the options on the command line, since in theory that shouldn't matter (this makes the tests more robust in the face of changes to the code). I'm pretty sure I transcribed all the tests correctly, but it would be great if you would double check me. |
|||
| msg169761 - (view) | Author: Anton Barkovsky (anton.barkovsky) * | Date: 2012年09月03日 13:13 | |
I think you forgot to write `test_open_with_autoraise_false` for Chrome tests. |
|||
| msg169766 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月03日 15:00 | |
I did indeed. |
|||
| msg169768 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年09月03日 16:03 | |
I added some comments on the latest patch on the review tool. |
|||
| msg169775 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2012年09月03日 16:53 | |
New changeset 5da3b2df38b3 by R David Murray in branch 'default': #15557,#15447,#15509: webbrowser test suite added. http://hg.python.org/cpython/rev/5da3b2df38b3 |
|||
| msg169780 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月03日 16:56 | |
Thanks, Anton. And thank you Chris for the initial reviews. |
|||
| msg169784 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月03日 17:24 | |
Hmm. For some reason I did not get emailed these review comments, and I did not see your note before I did the checkin. I will take a look. |
|||
| msg169785 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年09月03日 17:33 | |
Thanks, David. I wasn't sure if you had seen the comments. They're mostly stylistic, though, so it's not too big of a deal. |
|||
| msg169786 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月03日 17:36 | |
Yeah, you make some good points, but I think I may already have spent more time on this that is justified by the amount of usage webbrowser gets :) So I think I'm going to leave it as is, as being 'good enough'. |
|||
| msg169787 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2012年09月03日 17:39 | |
Oh, I see. I did get the email, it's just that my email filter put it into a different folder from what I was expected. |
|||
| msg169788 - (view) | Author: Chris Jerdonek (chris.jerdonek) * (Python committer) | Date: 2012年09月03日 17:41 | |
Fair enough. :) I may keep a couple of those changes in mind if I ever have a chance to visit this module myself in the future. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:33 | admin | set | github: 59762 |
| 2012年09月03日 17:41:49 | chris.jerdonek | set | messages: + msg169788 |
| 2012年09月03日 17:39:10 | r.david.murray | set | messages: + msg169787 |
| 2012年09月03日 17:36:20 | r.david.murray | set | messages: + msg169786 |
| 2012年09月03日 17:33:56 | chris.jerdonek | set | messages: + msg169785 |
| 2012年09月03日 17:24:33 | r.david.murray | set | messages: + msg169784 |
| 2012年09月03日 16:56:25 | r.david.murray | set | status: open -> closed resolution: fixed messages: + msg169780 stage: resolved |
| 2012年09月03日 16:53:26 | python-dev | set | nosy:
+ python-dev messages: + msg169775 |
| 2012年09月03日 16:03:13 | chris.jerdonek | set | messages: + msg169768 |
| 2012年09月03日 15:00:27 | r.david.murray | set | files:
+ test_webbrowser.patch messages: + msg169766 |
| 2012年09月03日 13:13:21 | anton.barkovsky | set | messages: + msg169761 |
| 2012年09月03日 02:45:46 | r.david.murray | set | files:
+ test_webbrowser.patch messages: + msg169738 |
| 2012年08月13日 13:00:29 | asvetlov | set | nosy:
+ asvetlov |
| 2012年08月12日 19:56:24 | chris.jerdonek | set | messages: + msg168064 |
| 2012年08月12日 19:09:41 | anton.barkovsky | set | files:
+ test_webbrowser_v3.patch messages: + msg168060 |
| 2012年08月12日 16:30:19 | chris.jerdonek | set | messages: + msg168052 |
| 2012年08月12日 14:34:30 | anton.barkovsky | set | files:
+ test_webbrowser_v2.patch messages: + msg168041 |
| 2012年08月12日 04:36:22 | r.david.murray | set | messages: + msg168020 |
| 2012年08月11日 17:43:49 | chris.jerdonek | set | nosy:
+ chris.jerdonek messages: + msg167983 |
| 2012年08月11日 16:15:34 | pitrou | set | nosy:
+ georg.brandl |
| 2012年08月09日 13:22:11 | asvetlov | set | dependencies:
+ A file is not properly closed by webbrowser._invoke, UnixBrowser.open sometimes passes zero-length argument to the browser. versions: + Python 3.4, - Python 3.3 |
| 2012年08月04日 17:52:57 | anton.barkovsky | create | |