mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
MoobotFactoids: add check_same_thread=False to the sqlite3 connect calls, so it doesn't complain. (thanks malex!)
also fix up the code a bit so it doesn't fail the tests, and doesn't require presence of plain sqlite.
This commit is contained in:
parent
3a181b6dd2
commit
9398025088
@ -107,11 +107,11 @@ class SqliteMoobotDB(object):
|
||||
filename = plugins.makeChannelFilename(self.filename, channel)
|
||||
|
||||
if os.path.exists(filename):
|
||||
db = sqlite3.connect(filename)
|
||||
db = sqlite3.connect(filename, check_same_thread = False)
|
||||
db.text_factory = str
|
||||
self.dbs[channel] = db
|
||||
return db
|
||||
db = sqlite3.connect(filename)
|
||||
db = sqlite3.connect(filename, check_same_thread = False)
|
||||
db.text_factory = str
|
||||
self.dbs[channel] = db
|
||||
cursor = db.cursor()
|
||||
@ -281,7 +281,7 @@ class SqliteMoobotDB(object):
|
||||
results = cursor.fetchall()
|
||||
return results
|
||||
|
||||
MoobotDB = plugins.DB('MoobotFactoids', {'sqlite': SqliteMoobotDB})
|
||||
MoobotDB = plugins.DB('MoobotFactoids', {'sqlite3': SqliteMoobotDB})
|
||||
|
||||
class MoobotFactoids(callbacks.Plugin):
|
||||
"""Add the help for "@help MoobotFactoids" here (assuming you don't implement a MoobotFactoids
|
||||
|
@ -31,11 +31,10 @@
|
||||
from supybot.test import *
|
||||
#import supybot.plugin as plugin
|
||||
import supybot.ircutils as ircutils
|
||||
|
||||
try:
|
||||
import sqlite
|
||||
import sqlite3
|
||||
except ImportError:
|
||||
sqlite = None
|
||||
from pysqlite2 import dbapi2 as sqlite3 # for python2.4
|
||||
|
||||
MF = plugin.loadPluginModule('MoobotFactoids')
|
||||
MFconf = conf.supybot.plugins.MoobotFactoids
|
||||
@ -223,7 +222,7 @@ class FactoidsTestCase(ChannelPluginTestCase):
|
||||
self.assertRegexp('most authored',
|
||||
'Most prolific authors:.*moo.*(1).*boo.*(1)')
|
||||
self.assertRegexp('most recent',
|
||||
"2 latest factoids:.*mogle.*moogle.*")
|
||||
"2 latest factoids:.*moogle.*mogle.*")
|
||||
self.assertResponse('moogle', 'moo')
|
||||
self.assertRegexp('most popular',
|
||||
"Top 1 requested factoid:.*moogle.*(2)")
|
||||
|
Loading…
Reference in New Issue
Block a user