Index: trunk/testing/installer/installer.py |
— | — | @@ -54,8 +54,10 @@ |
55 | 55 | all_args[0] is expected to be the command name. |
56 | 56 | """ |
57 | 57 | |
58 | | - if all_args[0] in commands: |
59 | | - commands[all_args[0]](all_args) |
| 58 | + command=all_args[0] |
| 59 | + |
| 60 | + if command in commands: |
| 61 | + commands[command](all_args) |
60 | 62 | else: |
61 | 63 | print "I don't know how to '"+all_args[0]+"'." |
62 | 64 | |
— | — | @@ -84,7 +86,6 @@ |
85 | 87 | """test something""" |
86 | 88 | installers.test(args) |
87 | 89 | |
88 | | - |
89 | 90 | def duplicate(args): |
90 | 91 | """duplicate an instance""" |
91 | 92 | if len(args)!=3: |
Index: trunk/testing/installer/installers.py |
— | — | @@ -19,6 +19,7 @@ |
20 | 20 | from installation_system import Installer_Exception |
21 | 21 | from download_installer import Download_Installer |
22 | 22 | from extension_installer2 import extension_installer2 |
| 23 | +from test_system import Test_System,Test_Exception |
23 | 24 | |
24 | 25 | from tags import Tags, TagsException |
25 | 26 | |
— | — | @@ -180,8 +181,9 @@ |
181 | 182 | |
182 | 183 | def install(args): |
183 | 184 | """install something. What gets installed depends on the path""" |
184 | | - if len(args)<1: |
| 185 | + if len(args)<2: |
185 | 186 | print "install: Internal error: expected more arguments" |
| 187 | + return |
186 | 188 | |
187 | 189 | ppath=None |
188 | 190 | try: |
— | — | @@ -214,11 +216,26 @@ |
215 | 217 | except Installer_Exception,e: |
216 | 218 | print e.message |
217 | 219 | |
| 220 | +def test(args): |
| 221 | + if len(args)<2: |
| 222 | + print "test: Internal error: expected more arguments" |
| 223 | + return |
| 224 | + target=args[1] |
218 | 225 | |
| 226 | + test_system=Test_System() |
| 227 | + wiki_works=test_system.run_wikiworks(target) |
| 228 | + if wiki_works: |
| 229 | + print "* Wiki is up" |
| 230 | + else: |
| 231 | + print "* Wiki is DOWN" |
| 232 | + print "Test discontinued. " |
| 233 | + return |
| 234 | + |
219 | 235 | def uninstall(args): |
220 | 236 | """uninstall something. What gets uninstalled depends on the path""" |
221 | | - if len(args)<1: |
222 | | - print "install: Internal error: expected more arguments" |
| 237 | + if len(args)<2: |
| 238 | + print "uninstall: Internal error: expected more arguments" |
| 239 | + return |
223 | 240 | |
224 | 241 | ppath=None |
225 | 242 | try: |
Index: trunk/testing/installer/test_system.py |
— | — | @@ -20,36 +20,23 @@ |
21 | 21 | pass |
22 | 22 | |
23 | 23 | class Test_System(object): |
24 | | - """An Abstract Test System. Don't instantiate this class directly. |
25 | | - An installation system understands how to install and uninstall |
26 | | - 'things' (instances). An instance might be a particular wiki |
27 | | - (in the case of the mediawiki installer) or a particular extension |
28 | | - in that wiki (extension installer), or perhaps a tool from the |
29 | | - toolkit. |
30 | | - Next to installing and uninstalling, an installer can also determine |
31 | | - the status of an instance (installed or uninstalled), and can provide |
32 | | - lists of instances that are available or installed""" |
| 24 | + """An Abstract(?) Test System.""" |
33 | 25 | system_name=None |
34 | 26 | destination_dir=None |
35 | 27 | |
36 | 28 | def __init__(self,target=None): |
37 | 29 | if "wiki_works" not in globals(): |
38 | 30 | raise Test_Exception("You need to install pywikipedia and the extension-tester before you can run tests. You can find these fine tools under toolkit:") |
39 | | - self.testfilesdir=settings.testfilesdir |
| 31 | + self.testfiles=settings.testfiles |
40 | 32 | self.destination_dir=None |
41 | 33 | self.target=target |
42 | 34 | self.as_alias=None |
43 | 35 | self.revision=None |
44 | 36 | self.tag=None |
45 | | - if instance: |
46 | | - self.set_instance(instance) |
47 | 37 | |
48 | | - def set_instance(self,instance): |
49 | | - self.instance=instance |
50 | | - |
51 | 38 | def get_entities(self): |
52 | 39 | """list the extensions we have tests for""" |
53 | | - entities=os.listdir(self.testfilesdir) |
| 40 | + entities=os.listdir(self.testfiles) |
54 | 41 | entities=[] |
55 | 42 | for line in entities: |
56 | 43 | if line.endswith(".test"): |
— | — | @@ -76,9 +63,8 @@ |
77 | 64 | """returns the location of the .install directory for the given installer_name. |
78 | 65 | An installer directory is where we store all the scripts to install one particular |
79 | 66 | extension, tool from the toolkit, or etc. """ |
80 | | - return os.path.join(self.testfilesdir, entity_name+".tests") |
| 67 | + return os.path.join(self.testfiles, entity_name+".tests") |
81 | 68 | |
82 | | - |
83 | 69 | |
84 | 70 | def test (self, entity, test, target=None): |
85 | 71 | if not target: |
— | — | @@ -93,6 +79,7 @@ |
94 | 80 | raise Test_Exception("I don't know of a test called '"+str(test)+"'.") |
95 | 81 | |
96 | 82 | def run_exttest(self,target,entity): |
| 83 | + """XXX TODO """ |
97 | 84 | pass |
98 | 85 | |
99 | 86 | def run_wikiworks(self,target): |