On Tue, Jun 10, 2008 at 4:39 PM, Ian Bicking <[EMAIL PROTECTED]> wrote: > > You don't give the imports in the documentation, but I'm assuming > testutil is a module.
Yeah.. it's a module. The imports are given on the main testing page [1]. A TG developer looking at the TestMigration page would ordinarily be familiar with that part. > You seem to be using module globals to manage the > application? This seems problematic to me. Specifically this example: > > testutil.mount(MyRoot()) > testutil.mount(SubApp(), '/subthing') > app = testutil.make_app() > > I guess this is optional, but even as an optional technique it seems > problematic. One issue is how this can affect different tests, whether > these module-level side effects can leak from one test to another. I > suppose this would feel more comfortable to someone used to CherryPy, > but just reading this code leaves me feeling confused -- where are you > mounting things, what does make_app return? > > -- > Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org Nope, no new module-level globals in testutil. "mount" just grafts on to CherryPy's traversal tree. I haven't looked to see if CP uses a threadlocal or what there, but I'm not concerned regardless. For starters, it's the same behavior as you get with tg 1.0's testing, but also I don't see a use case where it'd be a problem. We actually had to fix about half a dozen tests that were dependent on side-effects in order to make this change. I won't guarantee that there aren't still some out there, but there's a lot less at any rate. As far as 'make_app,' it returns a WebTest.TestApp instance; I'll look at the wording of the explanation again & see if I can fine-tune it. A name like 'make_testapp' might be clearer, but it'll be used a lot, so a short name is important, too. The name is also an attempt at forward compatibility, since it's the same as what TurboGears 2's tests.base module uses. thanks, -Ken [1] http://docs.turbogears.org/1.1/Testing. Right now this is just a light revision of the 1.0 page. I'll keep your criticism in mind when I give that page the overhaul it needs. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en -~----------~----~----~----~------~----~------~--~---
