~jayvdb/testscenarios/0.4

« back to all changes in this revision

Viewing changes to README

  • Committer: Robert Collins
  • Date: 2010-10-12 06:57:23 UTC
  • mfrom: (17.1.3 658044-multiply)
  • Revision ID: robertc@robertcollins.net-20101012065723-13z174op8al4s6zn
Merge a tweaked version of Martins load_tests and multiply_scenarios patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
128
128
  ...     result.addTests(generate_scenarios(standard_tests))
129
129
  ...     return result
130
130
 
 
131
as a convenience, this is available in ``load_tests_apply_scenarios``, so a
 
132
module using scenario tests need only say ::
 
133
 
 
134
  >>> from testscenarios import load_tests_apply_scenarios as load_tests
 
135
 
 
136
Python 2.7 and greater support a different calling convention for `load_tests``
 
137
<https://bugs.launchpad.net/bzr/+bug/607412>.  `load_tests_apply_scenarios`
 
138
copes with both.
 
139
 
131
140
With ``test_suite``::
132
141
 
133
142
  >>> def test_suite():
254
263
 
255
264
If a parameterised test is because of a bug run without being parameterized,
256
265
it should fail rather than running with defaults, because this can hide bugs.
 
266
 
 
267
 
 
268
Producing Scenarios
 
269
===================
 
270
 
 
271
The `multiply_scenarios` function produces the cross-product of the scenarios
 
272
passed in::
 
273
 
 
274
  >>> from testscenarios.scenarios import multiply_scenarios
 
275
  >>> 
 
276
  >>> scenarios = multiply_scenarios(
 
277
  ...      [('scenario1', dict(param1=1)), ('scenario2', dict(param1=2))],
 
278
  ...      [('scenario2', dict(param2=1))],
 
279
  ...      )
 
280
  >>> scenarios == [('scenario1,scenario2', {'param2': 1, 'param1': 1}),
 
281
  ...               ('scenario2,scenario2', {'param2': 1, 'param1': 2})]
 
282
  True