r50626 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50625‎ | r50626 | r50627 >
Date:12:15, 15 May 2009
Author:kim
Status:deferred
Tags:
Comment:
First simple test integrated!
\o/
Modified paths:
  • /trunk/testing/installer/installer.py (modified) (history)
  • /trunk/testing/installer/installers.py (modified) (history)
  • /trunk/testing/installer/test_system.py (modified) (history)

Diff [purge]

Index: trunk/testing/installer/installer.py
@@ -54,8 +54,10 @@
5555 all_args[0] is expected to be the command name.
5656 """
5757
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)
6062 else:
6163 print "I don't know how to '"+all_args[0]+"'."
6264
@@ -84,7 +86,6 @@
8587 """test something"""
8688 installers.test(args)
8789
88 -
8990 def duplicate(args):
9091 """duplicate an instance"""
9192 if len(args)!=3:
Index: trunk/testing/installer/installers.py
@@ -19,6 +19,7 @@
2020 from installation_system import Installer_Exception
2121 from download_installer import Download_Installer
2222 from extension_installer2 import extension_installer2
 23+from test_system import Test_System,Test_Exception
2324
2425 from tags import Tags, TagsException
2526
@@ -180,8 +181,9 @@
181182
182183 def install(args):
183184 """install something. What gets installed depends on the path"""
184 - if len(args)<1:
 185+ if len(args)<2:
185186 print "install: Internal error: expected more arguments"
 187+ return
186188
187189 ppath=None
188190 try:
@@ -214,11 +216,26 @@
215217 except Installer_Exception,e:
216218 print e.message
217219
 220+def test(args):
 221+ if len(args)<2:
 222+ print "test: Internal error: expected more arguments"
 223+ return
 224+ target=args[1]
218225
 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+
219235 def uninstall(args):
220236 """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
223240
224241 ppath=None
225242 try:
Index: trunk/testing/installer/test_system.py
@@ -20,36 +20,23 @@
2121 pass
2222
2323 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."""
3325 system_name=None
3426 destination_dir=None
3527
3628 def __init__(self,target=None):
3729 if "wiki_works" not in globals():
3830 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
4032 self.destination_dir=None
4133 self.target=target
4234 self.as_alias=None
4335 self.revision=None
4436 self.tag=None
45 - if instance:
46 - self.set_instance(instance)
4737
48 - def set_instance(self,instance):
49 - self.instance=instance
50 -
5138 def get_entities(self):
5239 """list the extensions we have tests for"""
53 - entities=os.listdir(self.testfilesdir)
 40+ entities=os.listdir(self.testfiles)
5441 entities=[]
5542 for line in entities:
5643 if line.endswith(".test"):
@@ -76,9 +63,8 @@
7764 """returns the location of the .install directory for the given installer_name.
7865 An installer directory is where we store all the scripts to install one particular
7966 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")
8168
82 -
8369
8470 def test (self, entity, test, target=None):
8571 if not target:
@@ -93,6 +79,7 @@
9480 raise Test_Exception("I don't know of a test called '"+str(test)+"'.")
9581
9682 def run_exttest(self,target,entity):
 83+ """XXX TODO """
9784 pass
9885
9986 def run_wikiworks(self,target):

Status & tagging log