Updated to make sure the test doesn't run if sqlite isn't installed.

This commit is contained in:
Jeremy Fincher 2003-10-04 13:59:50 +00:00
parent 3af3b4c985
commit 93cc17ab43
7 changed files with 273 additions and 229 deletions

View File

@ -31,7 +31,13 @@
from test import * from test import *
class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation): try:
import sqlite
except ImportError:
sqlite = None
if sqlite is not None:
class ChannelDBTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('ChannelDB',) plugins = ('ChannelDB',)
def test(self): def test(self):
self.assertNotError('channelstats') self.assertNotError('channelstats')

View File

@ -31,7 +31,13 @@
from test import * from test import *
class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation): try:
import sqlite
except ImportError:
sqlite = None
if sqlite is not None:
class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('Factoids',) plugins = ('Factoids',)
def testRandomfactoid(self): def testRandomfactoid(self):
self.assertError('randomfactoid') self.assertError('randomfactoid')
@ -43,7 +49,7 @@ class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('factoidinfo jemfinch') self.assertNotError('factoidinfo jemfinch')
self.assertRegexp('whatis jemfinch', 'my primary author') self.assertRegexp('whatis jemfinch', 'my primary author')
self.assertRegexp('whatis JEMFINCH', 'my primary author') self.assertRegexp('whatis JEMFINCH', 'my primary author')
self.assertNotError('learn jemfinch as a crappy assembly programmer') self.assertNotError('learn jemfinch as a bad assembly programmer')
self.assertRegexp('whatis jemfinch', r'.*primary author.*assembly') self.assertRegexp('whatis jemfinch', r'.*primary author.*assembly')
self.assertError('forget jemfinch') self.assertError('forget jemfinch')
self.assertError('forget jemfinch 3') self.assertError('forget jemfinch 3')
@ -69,14 +75,16 @@ class FactoidsTestCase(ChannelPluginTestCase, PluginDocumentation):
def testSearchFactoids(self): def testSearchFactoids(self):
self.assertNotError('learn jemfinch as my primary author') self.assertNotError('learn jemfinch as my primary author')
self.assertNotError('learn strike as another cool guy working on me') self.assertNotError('learn strike as a cool guy working on me')
self.assertNotError('learn inkedmn as another of my developers') self.assertNotError('learn inkedmn as another of my developers')
self.assertNotError('learn jamessan as a developer of much python') self.assertNotError('learn jamessan as a developer of much python')
self.assertNotError('learn bwp as the author of my weather command') self.assertNotError('learn bwp as author of my weather command')
self.assertRegexp('searchfactoids --regexp /.w./', 'bwp') self.assertRegexp('searchfactoids --regexp /.w./', 'bwp')
self.assertRegexp('searchfactoids --regexp /^.+i/', 'jemfinch.*strike') self.assertRegexp('searchfactoids --regexp /^.+i/',
'jemfinch.*strike')
self.assertNotRegexp('searchfactoids --regexp /^.+i/', 'inkedmn') self.assertNotRegexp('searchfactoids --regexp /^.+i/', 'inkedmn')
self.assertRegexp('searchfactoids --regexp /^j/', 'jemfinch.*jamessan') self.assertRegexp('searchfactoids --regexp /^j/',
'jemfinch.*jamessan')
self.assertRegexp('searchfactoids j*', 'jemfinch.*jamessan') self.assertRegexp('searchfactoids j*', 'jemfinch.*jamessan')
self.assertRegexp('searchfactoids --exact ke', self.assertRegexp('searchfactoids --exact ke',
'inkedmn.*strike|strike.*inkedmn') 'inkedmn.*strike|strike.*inkedmn')

View File

@ -31,7 +31,13 @@
from test import * from test import *
class TestFunDB(PluginTestCase, PluginDocumentation): try:
import sqlite
except ImportError:
sqlite = None
if sqlite is not None:
class TestFunDB(PluginTestCase, PluginDocumentation):
plugins = ('FunDB',) plugins = ('FunDB',)
def testDbAdd(self): def testDbAdd(self):

View File

@ -33,7 +33,14 @@ from test import *
import utils import utils
class NewsTestCase(ChannelPluginTestCase): try:
import sqlite
except ImportError:
sqlite = None
if sqlite is not None:
class NewsTestCase(ChannelPluginTestCase):
plugins = ('News',) plugins = ('News',)
def testAddNews(self): def testAddNews(self):
self.assertNotError('addnews #somechannel 0 subject: foo') self.assertNotError('addnews #somechannel 0 subject: foo')

View File

@ -34,7 +34,13 @@ from test import *
import utils import utils
import ircdb import ircdb
class NotesTestCase(PluginTestCase, PluginDocumentation): try:
import sqlite
except ImportError:
sqlite = None
if sqlite is not None:
class NotesTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Notes', 'MiscCommands', 'UserCommands') plugins = ('Notes', 'MiscCommands', 'UserCommands')
def testHelps(self): def testHelps(self):
self.assertNotError('help sendnote') self.assertNotError('help sendnote')

View File

@ -31,7 +31,13 @@
from test import * from test import *
class QuotesTestCase(PluginTestCase, PluginDocumentation): try:
import sqlite
except ImportError:
sqlite = None
if sqlite is not None:
class QuotesTestCase(PluginTestCase, PluginDocumentation):
plugins = ('Quotes',) plugins = ('Quotes',)
def test(self): def test(self):
self.assertRegexp('numquotes #foo', '0') self.assertRegexp('numquotes #foo', '0')

View File

@ -66,8 +66,13 @@ http://gameknot.com/tsignup.pl
http://lambda.weblogs.com/xml/rss.xml http://lambda.weblogs.com/xml/rss.xml
""".strip().splitlines() """.strip().splitlines()
try:
import sqlite
except ImportError:
sqlite = None
class URLSnarferTestCase(ChannelPluginTestCase, PluginDocumentation): if sqlite is not None:
class URLSnarferTestCase(ChannelPluginTestCase, PluginDocumentation):
plugins = ('URLSnarfer',) plugins = ('URLSnarfer',)
def test(self): def test(self):
counter = 0 counter = 0