~jayvdb/testscenarios/0.4

« back to all changes in this revision

Viewing changes to lib/testscenarios/tests/test_scenarios.py

  • 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:
2
2
#  dependency injection ('scenarios') by tests.
3
3
#
4
4
# Copyright (c) 2009, Robert Collins <robertc@robertcollins.net>
5
 
# Copyright (c) 2010 Martin Pool <mbp@sourcefrog.net>
 
5
# Copyright (c) 2010, 2011 Martin Pool <mbp@sourcefrog.net>
6
6
7
7
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
8
8
# license at the users choice. A copy of both licenses are available in the
239
239
        self.assertEqual(
240
240
            'a,a,a,a',
241
241
            scenarios[0][0])
 
242
 
 
243
 
 
244
class TestPerModuleScenarios(testtools.TestCase):
 
245
 
 
246
    def test_per_module_scenarios(self):
 
247
        """Generate scenarios for available modules"""
 
248
        s = testscenarios.scenarios.per_module_scenarios(
 
249
            'the_module', [
 
250
                ('Python', 'testscenarios'),
 
251
                ('unittest', 'unittest'),
 
252
                ('nonexistent', 'nonexistent'),
 
253
                ])
 
254
        self.assertEqual(s, [
 
255
            ('Python', {'the_module': testscenarios}),
 
256
            ('unittest', {'the_module': unittest}),
 
257
            ])