~ubuntu-branches/ubuntu/saucy/testresources/saucy-proposed

« back to all changes in this revision

Viewing changes to doc/example.py

  • Committer: Bazaar Package Importer
  • Author(s): Robert Collins
  • Date: 2010-02-27 10:04:22 UTC
  • mfrom: (1.1.5 upstream) (2.1.6 sid)
  • Revision ID: james.westby@ubuntu.com-20100227100422-lt9yiszrs23wl8r3
Tags: 0.2.4-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#  testresources: extensions to python unittest to allow declaritive use
2
2
#  of resources by test cases.
3
 
#  Copyright (C) 2005-2008  Robert Collins <robertc@robertcollins.net>
4
 
#
5
 
#  This program is free software; you can redistribute it and/or modify
6
 
#  it under the terms of the GNU General Public License as published by
7
 
#  the Free Software Foundation; either version 2 of the License, or
8
 
#  (at your option) any later version.
9
 
#
10
 
#  This program is distributed in the hope that it will be useful,
11
 
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
#  GNU General Public License for more details.
14
 
#
15
 
#  You should have received a copy of the GNU General Public License
16
 
#  along with this program; if not, write to the Free Software
17
 
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
#
19
 
 
20
 
"""Example TestResource."""
21
 
 
22
 
from testresources import TestResource
23
 
 
24
 
 
25
 
class SampleTestResource(TestResource):
 
3
#
 
4
#  Copyright (c) 2005-2010 Testresources Contributors
 
5
#  
 
6
#  Licensed under either the Apache License, Version 2.0 or the BSD 3-clause
 
7
#  license at the users choice. A copy of both licenses are available in the
 
8
#  project source as Apache-2.0 and BSD. You may not use this file except in
 
9
#  compliance with one of these two licences.
 
10
#  
 
11
#  Unless required by applicable law or agreed to in writing, software distributed
 
12
#  under these licenses is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 
13
#  CONDITIONS OF ANY KIND, either express or implied.  See the license you chose
 
14
#  for the specific language governing permissions and limitations under that
 
15
#  license.
 
16
#
 
17
 
 
18
"""Example TestResourceManager."""
 
19
 
 
20
from testresources import TestResourceManager
 
21
 
 
22
 
 
23
class SampleTestResource(TestResourceManager):
26
24
 
27
25
    setUpCost = 2
28
26
    tearDownCost = 2
35
33
    """My pet resource."""
36
34
 
37
35
 
38
 
class SampleWithDependencies(TestResource):
 
36
class SampleWithDependencies(TestResourceManager):
39
37
 
40
38
    resources = [('foo', SampleTestResource()), ('bar', SampleTestResource())]
41
39