want declarative per-test-class variations
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
testscenarios |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
In https:/
class TestCheckout(
variations = [VaryByReposito
load_tests = load_tests_
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-
- 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
- Robert Collins: Approve
-
Diff: 209 lines (+149/-0)3 files modifiedREADME (+26/-0)
lib/testscenarios/scenarios.py (+53/-0)
lib/testscenarios/tests/test_scenarios.py (+70/-0)
Changed in testscenarios: | |
status: | In Progress → Fix Released |
You can simply set .scenarios on a test (or test case) and generate_scenarios will pick it up. Is more than that needed?