mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
fec048389a
commit
a2225ab47f
@ -7,7 +7,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import os, tempfile
|
import os, tempfile, time
|
||||||
from Queue import Queue, Empty
|
from Queue import Queue, Empty
|
||||||
from threading import Event
|
from threading import Event
|
||||||
|
|
||||||
@ -48,11 +48,15 @@ def test_identify_plugin(name, tests):
|
|||||||
abort = Event()
|
abort = Event()
|
||||||
prints('Log saved to', lf)
|
prints('Log saved to', lf)
|
||||||
|
|
||||||
|
times = []
|
||||||
for kwargs, test_funcs in tests:
|
for kwargs, test_funcs in tests:
|
||||||
prints('Running test with:', kwargs)
|
prints('Running test with:', kwargs)
|
||||||
rq = Queue()
|
rq = Queue()
|
||||||
args = (log, rq, abort)
|
args = (log, rq, abort)
|
||||||
|
start_time = time.time()
|
||||||
err = plugin.identify(*args, **kwargs)
|
err = plugin.identify(*args, **kwargs)
|
||||||
|
total_time = time.time() - start_time
|
||||||
|
times.append(total_time)
|
||||||
if err is not None:
|
if err is not None:
|
||||||
prints('identify returned an error for args', args)
|
prints('identify returned an error for args', args)
|
||||||
prints(err)
|
prints(err)
|
||||||
@ -87,6 +91,8 @@ def test_identify_plugin(name, tests):
|
|||||||
prints('Log saved to', lf)
|
prints('Log saved to', lf)
|
||||||
raise SystemExit(1)
|
raise SystemExit(1)
|
||||||
|
|
||||||
|
prints('Average time per query', sum(times)/len(times))
|
||||||
|
|
||||||
if os.stat(lf).st_size > 10:
|
if os.stat(lf).st_size > 10:
|
||||||
prints('There were some errors, see log', lf)
|
prints('There were some errors, see log', lf)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user