summaryrefslogtreecommitdiffstats
path: root/module/database
diff options
context:
space:
mode:
authorGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-19 02:23:19 +0200
committerGravatar Walter Purcaro <vuolter@gmail.com> 2014-07-19 02:23:19 +0200
commit0aca8ebfb15237e60effce06ccff2085516117f6 (patch)
treee3f28471f4f682f333d5f1b0725ec6572b9cb1bc /module/database
parentMove test stuff to common directory (diff)
downloadpyload-0aca8ebfb15237e60effce06ccff2085516117f6.tar.xz
Remove self-tests from all files
Diffstat (limited to 'module/database')
-rw-r--r--module/database/DatabaseBackend.py45
-rw-r--r--module/database/FileDatabase.py49
2 files changed, 0 insertions, 94 deletions
diff --git a/module/database/DatabaseBackend.py b/module/database/DatabaseBackend.py
index 15d45e784..df2660063 100644
--- a/module/database/DatabaseBackend.py
+++ b/module/database/DatabaseBackend.py
@@ -303,48 +303,3 @@ class DatabaseBackend(Thread):
for sub in DatabaseBackend.subs:
if hasattr(sub, attr):
return getattr(sub, attr)
-
-if __name__ == "__main__":
- db = DatabaseBackend()
- db.setup()
-
- class Test:
- @style.queue
- def insert(db):
- c = db.createCursor()
- for i in range(1000):
- c.execute("INSERT INTO storage (identifier, key, value) VALUES (?, ?, ?)", ("foo", i, "bar"))
- @style.async
- def insert2(db):
- c = db.createCursor()
- for i in range(1000*1000):
- c.execute("INSERT INTO storage (identifier, key, value) VALUES (?, ?, ?)", ("foo", i, "bar"))
-
- @style.queue
- def select(db):
- c = db.createCursor()
- for i in range(10):
- res = c.execute("SELECT value FROM storage WHERE identifier=? AND key=?", ("foo", i))
- print res.fetchone()
-
- @style.queue
- def error(db):
- c = db.createCursor()
- print "a"
- c.execute("SELECT myerror FROM storage WHERE identifier=? AND key=?", ("foo", i))
- print "e"
-
- db.registerSub(Test)
- from time import time
- start = time()
- for i in range(100):
- db.insert()
- end = time()
- print end-start
-
- start = time()
- db.insert2()
- end = time()
- print end-start
-
- db.error()
diff --git a/module/database/FileDatabase.py b/module/database/FileDatabase.py
index 4a5e7c0ef..f01d02769 100644
--- a/module/database/FileDatabase.py
+++ b/module/database/FileDatabase.py
@@ -889,52 +889,3 @@ class FileMethods:
self.c.execute("DELETE FROM packages;")
DatabaseBackend.registerSub(FileMethods)
-
-if __name__ == "__main__":
-
- pypath = "."
- _ = lambda x: x
-
- db = FileHandler(None)
-
- #p = PyFile(db, 5)
- #sleep(0.1)
-
- a = time()
-
- #print db.addPackage("package", "folder" , 1)
-
- pack = db.db.addPackage("package", "folder", 1)
-
- updates = []
-
- for x in range(0, 200):
- x = str(x)
- db.db.addLink("http://somehost.com/hoster/file/download?file_id=" + x, x, "BasePlugin", pack)
- updates.append(("new name" + x, 0, 3, "http://somehost.com/hoster/file/download?file_id=" + x))
-
-
- for x in range(0, 100):
- updates.append(("unimportant%s" % x, 0, 3, "a really long non existent url%s" % x))
-
- db.db.commit()
-
- b = time()
- print "adding 200 links, single sql execs, no commit", b-a
-
- print db.getCompleteData(1)
-
- c = time()
-
-
- db.db.updateLinkInfo(updates)
-
- d = time()
-
- print "updates", d-c
-
- print db.getCompleteData(1)
-
- e = time()
-
- print "complete data", e-d