mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Make a dedicated entry point in calibre-debug for running tests
Fixes #1677 (One difference: using the new run_test() I see all the debug output …)
This commit is contained in:
parent
8002c9c8bb
commit
be43cc25db
@ -102,6 +102,8 @@ Everything after the -- is passed to the script.
|
||||
'Run a plugin that provides a command line interface. For example:\n'
|
||||
'calibre-debug -r "Plugin name" -- file1 --option1\n'
|
||||
'Everything after the -- will be passed to the plugin as arguments.'))
|
||||
parser.add_option('-t', '--run-test', help=_(
|
||||
'Run the named test(s)'))
|
||||
parser.add_option('--diff', action='store_true', default=False, help=_(
|
||||
'Run the calibre diff tool. For example:\n'
|
||||
'calibre-debug --diff file1 file2'))
|
||||
@ -313,6 +315,11 @@ def main(args=sys.argv):
|
||||
prints(_('No plugin named %s found')%opts.run_plugin)
|
||||
raise SystemExit(1)
|
||||
plugin.cli_main([plugin.name] + args[1:])
|
||||
elif opts.run_test:
|
||||
from calibre.utils.run_tests import run_test
|
||||
from calibre.constants import debug
|
||||
debug(False)
|
||||
run_test(opts.run_test)
|
||||
elif opts.diff:
|
||||
from calibre.gui2.tweak_book.diff.main import main
|
||||
main(['calibre-diff'] + args[1:])
|
||||
|
@ -301,7 +301,7 @@ def find_tests(which_tests=None, exclude_tests=None):
|
||||
|
||||
|
||||
def run_test(test_name, verbosity=4, buffer=False):
|
||||
# calibre-debug -c "from calibre.utils.run_tests import *; import sys; run_test(sys.argv[-1])" some_test_name
|
||||
# calibre-debug -t test_name
|
||||
tests = find_tests()
|
||||
tests = filter_tests_by_name(tests, test_name)
|
||||
if not tests._tests:
|
||||
|
Loading…
x
Reference in New Issue
Block a user