1 | |
---|
2 | # TestSuite |
---|
3 | |
---|
4 | |
---|
5 | ## Overview |
---|
6 | |
---|
7 | This is a class intended to serve as a container for an entire test suite, instantiated from an XML specification file. A TestSuite object contains Distribution classes, which in turn will each contain zero or more Metcases. A TestSuite object stores all of the necessary parameters and paths for testing routines to do their job. |
---|
8 | |
---|
9 | |
---|
10 | An example of its use |
---|
11 | |
---|
12 | |
---|
13 | import distrotest.TestSuite as TS |
---|
14 | |
---|
15 | import flextest.FlexpartCase as FlexpartCase |
---|
16 | import flextest.FlexpartExecutable as Fexec |
---|
17 | import flextest.FlexpartErrors as FlexpartErrors |
---|
18 | import flextest.flexread.FlexpartOutput as FlexpartOutput |
---|
19 | import flextest.OutputCompare as OutputCompare |
---|
20 | |
---|
21 | |
---|
22 | # Bring in the XML filename from the command line |
---|
23 | if len(sys.argv) == 2: |
---|
24 | xml_file = sys.argv[1] |
---|
25 | XML_FILE = [xml_file] |
---|
26 | else: |
---|
27 | print 'This program expects an XML filename as an argument...' |
---|
28 | sys.exit() |
---|
29 | |
---|
30 | t = TS.TestSuite(xml_files=XML_FILE) |
---|
31 | |
---|
32 | # Get the first distribution in the test suite |
---|
33 | distro_list = t.get_distribution_list() |
---|
34 | the_distro = distro_list[0] |
---|
35 | |
---|
36 | print the_distro.get_descr() |
---|
37 | print the_distro.get_distro_path() |
---|
38 | print the_distro.get_parmod_path() |
---|
39 | |
---|
40 | The object will instantiate on a list of XML files, each one constituting a *Distribution*. |
---|
41 | |
---|
42 | |
---|
43 | The pydoc representation: |
---|
44 | |
---|
45 | |
---|
46 | class TestSuite(__builtin__.object) |
---|
47 | | Container for an entire test suite, initialised from an XML config file. |
---|
48 | | A TestSuite object contains Distribution classes, which in turn will each |
---|
49 | | contain MetCase, RunCase and BasicTest objects. A TestSuite object should |
---|
50 | | have all of the information necessary for testing routines to do their |
---|
51 | | thang. |
---|
52 | | |
---|
53 | | Methods defined here: |
---|
54 | | |
---|
55 | | __init__(self, xml_files=None) |
---|
56 | | Creates a list of Distribution objects from a list of xml_files. |
---|
57 | | If only a single file is entered as an argument (which may often |
---|
58 | | be the case, it is inserted into a list of one element). An XML file |
---|
59 | | is read, and a Distribution object is manufactured from this |
---|
60 | | |
---|
61 | | get_distribution_list(self) |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | |
---|
66 | ## Issues |
---|
67 | |
---|
68 | * The class hard-codes the definition for scratch space - all of the tests will be performed in temporary directories. By default, these will all be under /tmp, but on some systems this may be a bad idea, especially if routines that use this class don't clean up afterwards. |
---|
69 | |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | |
---|