264
Some functions (currently one :-) are available to ease generation of scenario
265
lists for common situations.
267
Testing Per Implementation Module
268
+++++++++++++++++++++++++++++++++
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.
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
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.
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.
261
290
Advice on Writing Scenarios
262
291
===========================