~ubuntu-branches/ubuntu/lucid/mago/lucid

« back to all changes in this revision

Viewing changes to mago/test_suite/main.py

  • Committer: Bazaar Package Importer
  • Author(s): Ara Pulido
  • Date: 2009-08-04 09:21:40 UTC
  • Revision ID: james.westby@ubuntu.com-20090804092140-mnc0rm2tr7smo107
Tags: upstream-0.1
ImportĀ upstreamĀ versionĀ 0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""
 
2
test_suite module contains the definition of the TestSuite class that
 
3
must be used by all test suites written for the mago package
 
4
"""
 
5
from ..application.main import Application
 
6
from inspect import getsourcefile
 
7
from os.path import dirname
 
8
 
 
9
class TestSuite:
 
10
    """
 
11
    TestSuite that implements all the test suite methods desired in a
 
12
    test suite
 
13
    """
 
14
    def setup(self):
 
15
        pass
 
16
 
 
17
    def teardown(self):
 
18
        pass
 
19
 
 
20
    def cleanup(self):
 
21
        pass
 
22
 
 
23
    def get_test_dir(cls):
 
24
        return dirname(getsourcefile(cls))
 
25
    get_test_dir = classmethod(get_test_dir)
 
26
 
 
27
 
 
28
class SingleApplicationTestSuite(TestSuite):
 
29
    """
 
30
    Test suite intended to make sure that a single application is
 
31
    running
 
32
 
 
33
    APPLICATION_FACTORY: A class attribute that stores the factory for an
 
34
    Application instance.
 
35
    """
 
36
    APPLICATION_FACTORY = Application
 
37
    def __init__(self):
 
38
        self.application = self.APPLICATION_FACTORY()
 
39
 
 
40
    def cleanup(self):
 
41
        self.application.set_name(self.application.WINDOW)
 
42
        self.application.set_close_type(self.application.CLOSE_TYPE)
 
43
        self.application.set_close_name(self.application.CLOSE_NAME)