| 1 |
This is a report of which changes I took from Luke's patch & which from mine as I worked towards blending them into one. The goals of this rewrite are to: |
|---|
| 2 |
|
|---|
| 3 |
* Have a clean API with "one right way to do it" where possible. |
|---|
| 4 |
* Provide clear benifit to the users, so they're encouraged to move forward. |
|---|
| 5 |
* Be mindful of the fact that we want these tests to easily ported to TG2. |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
setup.py: |
|---|
| 9 |
* Install Requirements |
|---|
| 10 |
* Luke: added WebTest to install_requires |
|---|
| 11 |
* Ken added it to testtools & tgtesttools |
|---|
| 12 |
* Merged: Kept Ken's b/c testing's not part of the core. |
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
view/base.py: |
|---|
| 16 |
* When testing, add controller's result to the paste.testing. (WebTest |
|---|
| 17 |
captures this & attaches it to the response. |
|---|
| 18 |
* Luke: added it under 'namespace' key |
|---|
| 19 |
* Ken: added it under the 'raw' key |
|---|
| 20 |
* Merged: Kept Ken's because raw is more meaningful to users than namespace. |
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
testutil.py: |
|---|
| 24 |
* Add support for WebTest |
|---|
| 25 |
* Luke: |
|---|
| 26 |
* created TGWebTest, a subclass of unittest.TestCase. No mechanism for |
|---|
| 27 |
just getting the app (for those that think unittest has too much |
|---|
| 28 |
boilerplate). |
|---|
| 29 |
* created DBWebTest, which sets up both WebTest & the database. |
|---|
| 30 |
|
|---|
| 31 |
* Ken: |
|---|
| 32 |
* Made the tests more CP3 friendly. |
|---|
| 33 |
* Added mount & unmount functions. Deprecated reset_cp in favor of unmount. |
|---|
| 34 |
* Added start_server as a replacement for start_cp. |
|---|
| 35 |
* Added "go" function, a shortcut for creating a testapp & doing a get. |
|---|
| 36 |
* Converted BrowsingSession to use WebTest. |
|---|
| 37 |
|
|---|
| 38 |
* Merged: |
|---|
| 39 |
* Added make_wsgiapp, which returns a wsgi application from cherrypy |
|---|
| 40 |
* Added make_app, which returns a WebTest.TestApp instance |
|---|
| 41 |
from cherrypy |
|---|
| 42 |
* Kept Luke's TGWebTest, but made it use these base functions. |
|---|
| 43 |
* Left off DBWebTest for now, until I understand how it's used. |
|---|
| 44 |
|
|---|
| 45 |
* Kept Ken's attempt at making things CP3 friendly. It's not a |
|---|
| 46 |
current hot goal, but the number of lines are minimal & the |
|---|
| 47 |
tests have been a major sticking point. |
|---|
| 48 |
* Kept Ken's mount & unmount functions, but made mount simpler & |
|---|
| 49 |
fixed argument names. |
|---|
| 50 |
* Kept Ken's start_server, but dropped the ability to mount an app -- |
|---|
| 51 |
tg2 won't have the same concept of starting a server, so this is the |
|---|
| 52 |
wrong thing to overemphasize in tg1.1. |
|---|
| 53 |
* Moved Ken's automatic start_server logic from "go" to "mount". |
|---|
| 54 |
* Dropped Ken's "go" function. People should use either TGWebTest or |
|---|
| 55 |
make_app() |
|---|
| 56 |
* Kept Ken's changes to BrowsingSession. |
|---|
| 57 |
|
|---|
| 58 |
turbogears/tests/* |
|---|
| 59 |
* Modified to work with testutil as above. |
|---|
| 60 |
* Made better use of setup_module & teardown_module so that app can be mounted |
|---|
| 61 |
and server started a reasonable number of times. Some might complain that |
|---|
| 62 |
test isolation is reduced by this, but that's not a strong point - you don't |
|---|
| 63 |
stop your server after every request in production do you? Plus, the tests |
|---|
| 64 |
scream with this more practical (and more practiced) approach. |
|---|
| 65 |
* Used Ken's patches as a base (plus changes for the revised testutil) for test_catwalk, test_errorhandling, test_expose, test_view, test_testutil, test_sqlalchemy. They were more consistent with the style of the modules. |
|---|
| 66 |
* Used Luke's patches for test_paginate, test_controllers |
|---|
| 67 |
* In test_controllers, added some of Ken's stuff for handling return values |
|---|
| 68 |
from controllers instead of attaching them to 'self'. |
|---|
| 69 |
* Used a hybrid for test_form_controllers, test_identity |
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
* Just in case anyone's counting, test_controllers & test_paginate are the biggest test modules. 52 tests in the former, 34 in the later, out of a total of 185 tests in turbogears/tests (about half). |
|---|
| 74 |
|
|---|