Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1466 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

TG1 Test migration strategy

Reported by: mramm Owned by: anonymous
Priority: high Milestone: 2.0
Component: TurboGears Version: trunk
Severity: normal Keywords: sprint
Cc:

Description (last modified by mramm) (diff)

If people's tests don't port easily to TG2 it will be much harder to convince them that the TG2 upgrade process is safe and easy. So we should fake up an API to match cherrypy 2's test stuff, if we can do it in a reasonable way.

As mentioned in the comments, another solution would be to update tg1 to use a "framework neutral" test harness, so people could write forward compatible tests.

Attachments

webtest_prelim.patch Download (70.3 KB) - added by kskuhlman 11 years ago.
Preliminary effort for moving to webtest. Do not commit.

Change History

comment:1 Changed 12 years ago by mramm

I think we can write some simple test utilities that allow you to get the controller dict from response.namespace and emulate tg1 style tests.

Some test updates may be required, but as long as these are documented and kept to a minimum that is OK -- at least for now.

comment:2 Changed 12 years ago by mramm

It's also been suggested that we create a way to write twill tests using wsgi-intercept for both tg1 and 2, so that we can encourage that as a cross-version testing mechanism.

Alternatively we could work on using paste.fixture to test tg1 apps, which would then become the way to do testing across 1.1 and 2.0.

comment:3 Changed 12 years ago by mramm

  • Description modified (diff)

comment:4 Changed 12 years ago by kskuhlman

  • Keywords sprint added

I'll be working in this area during the Jan 12-13 sprint. I've got some tweaks to twill, wsgi_intercept, & tg 1 to make the wsgi environment available. It should be trivial from there to replace testutil's create_request, call, & call_with_request so that they're not so dependent on cp2 internals.

Obviously I'm working with twill right now, but switching to paste.fixture or perhaps even webtest is definitely on the table if twill ends up not being a good fit. It's relatively weak python API is the likeliest barrier.

I still need to learn the "tg2 way" & how to incorporate these ideas, so I'm leaving this ticket unassigned for now. Once I'm more comfortable with tg2, I'll assign myself if no one else has grabbed it by then.

comment:5 Changed 12 years ago by mramm

  • Priority changed from normal to high

Changed 11 years ago by kskuhlman

Preliminary effort for moving to webtest. Do not commit.

comment:6 Changed 11 years ago by kskuhlman

I wasn't able to get the twill-based approach to perform acceptably, plus it relied on some changes to twill that Titus hasn't accepted yet, so I fell back to the webtest route. Since tg2 is using webtest, this is probably the right solution anyway.

I've attached a patch to document where I'm at. It's not quite ready to be committed, but it's far enough along to receive criticism. All tests pass with this applied against the 1.1 branch.

Note that this issue is also  being discussed on the trunk mailing list.

comment:7 Changed 11 years ago by mramm

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.