~jayvdb/testscenarios/fix-py3-tests

« back to all changes in this revision

Viewing changes to README

  • Committer: Martin Pool
  • Date: 2010-12-09 02:40:21 UTC
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: mbp@canonical.com-20101209024021-4finptl33wp3kcs5
Add per_module_scenarios

Show diffs side-by-side

added added

removed removed

Lines of Context:
258
258
selection.
259
259
 
260
260
 
 
261
Generating Scenarios
 
262
====================
 
263
 
 
264
Some functions (currently one :-) are available to ease generation of scenario
 
265
lists for common situations.
 
266
 
 
267
Testing Per Implementation Module
 
268
+++++++++++++++++++++++++++++++++
 
269
 
 
270
It is reasonably common to have multiple Python modules that provide the same
 
271
capabilities and interface, and to want apply the same tests to all of them.
 
272
 
 
273
In some cases, not all of the statically defined implementations will be able
 
274
to be used in a particular testing environment.  For example, there may be both
 
275
a C and a pure-Python implementation of a module.  You want to test the C
 
276
module if it can be loaded, but also to have the tests pass if the C module has
 
277
not been compiled.
 
278
 
 
279
The ``per_module_scenarios`` function generates a scenario for each named
 
280
module, omitting those that raise an ``ImportError``.  For each test object,
 
281
the implementation to be tested is installed into a given attribute.
 
282
 
 
283
Note that for the test to be valid, all access to the module under test must go
 
284
through the relevant attribute of the test object.  If one of the
 
285
implementations is also directly imported by the test module or any other,
 
286
testscenarios will not magically stop it being used.
 
287
 
 
288
 
 
289
 
261
290
Advice on Writing Scenarios
262
291
===========================
263
292