want declarative per-test-class variations

Bug #658044 reported by Martin Pool
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testscenarios
Fix Released
Undecided
Unassigned

Bug Description

In https://code.edge.launchpad.net/~mbp/bzr/597791-http-tests/+merge/37941 I've tried something in bzr that lets you say this:

  class TestCheckout(TestCase):
    variations = [VaryByRepositoryFormat(), VaryByTreeFormat()]

  load_tests = load_tests_from_their_variations

I would like something like this (perhaps this same code) to be reusable in testscenarios. It builds on scenarios; you can mix and match.

To me this is nice because:

 - The per-class expression is as small as it could reasonably be.
 - There is less magic action-at-a-distance: each class describes how it is varied
 - People are gently encouraged to make reusable classes that describe variations, rather than writing them inline in the load_tests method
 - load_tests, which is a bit of a unittest implementation wart, does not need to be touched by most test code
 - Variations can be composed, given constructor parameters, etc

Related branches

Revision history for this message
Robert Collins (lifeless) wrote :

You can simply set .scenarios on a test (or test case) and generate_scenarios will pick it up. Is more than that needed?

Changed in testscenarios:
status: New → Incomplete
Revision history for this message
Martin Pool (mbp) wrote :

I think two more things are needed in testscenarios:
 * a builtin load_tests_apply_scenarios; ideally one that copes with bug 607412
 * multiply_scenarios that can be used in class declarations and that works properly with generators

I don't think laziness is actually needed, and using a class rather than a simple function may be too java-ish.

Changed in testscenarios:
status: Incomplete → In Progress
Revision history for this message
Robert Collins (lifeless) wrote :

This looks like it should be fix released now. Do you agree?

Martin Pool (mbp)
Changed in testscenarios:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.