mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Allow running test_rs with libasan preloaded
This commit is contained in:
parent
c1e5dd0fbb
commit
68b931d3d8
@ -10,25 +10,7 @@ from setup import Command, ismacos, is_ci
|
||||
TEST_MODULES = frozenset('srv db polish opf css docx cfi matcher icu smartypants build misc dbcli ebooks'.split())
|
||||
|
||||
|
||||
class Test(Command):
|
||||
|
||||
description = 'Run the calibre test suite'
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.add_option('--test-verbosity', type=int, default=4, help='Test verbosity (0-4)')
|
||||
parser.add_option('--test-module', '--test-group', default=[], action='append', type='choice', choices=sorted(map(str, TEST_MODULES)),
|
||||
help='The test module to run (can be specified more than once for multiple modules). Choices: %s' % ', '.join(sorted(TEST_MODULES)))
|
||||
parser.add_option('--test-name', '-n', default=[], action='append',
|
||||
help='The name of an individual test to run. Can be specified more than once for multiple tests. The name of the'
|
||||
' test is the name of the test function without the leading test_. For example, the function test_something()'
|
||||
' can be run by specifying the name "something".')
|
||||
parser.add_option('--exclude-test-module', default=[], action='append', type='choice', choices=sorted(map(str, TEST_MODULES)),
|
||||
help='A test module to be excluded from the test run (can be specified more than once for multiple modules).'
|
||||
' Choices: %s' % ', '.join(sorted(TEST_MODULES)))
|
||||
parser.add_option('--exclude-test-name', default=[], action='append',
|
||||
help='The name of an individual test to be excluded from the test run. Can be specified more than once for multiple tests.')
|
||||
parser.add_option('--under-sanitize', default=False, action='store_true',
|
||||
help='Run the test suite with the sanitizer preloaded')
|
||||
class BaseTest(Command):
|
||||
|
||||
def run(self, opts):
|
||||
if opts.under_sanitize and 'CALIBRE_EXECED_UNDER_SANITIZE' not in os.environ:
|
||||
@ -41,6 +23,32 @@ class Test(Command):
|
||||
sys.stdout.flush()
|
||||
os.execl('setup.py', *sys.argv)
|
||||
|
||||
def add_options(self, parser):
|
||||
parser.add_option('--under-sanitize', default=False, action='store_true',
|
||||
help='Run the test suite with the sanitizer preloaded')
|
||||
|
||||
|
||||
class Test(BaseTest):
|
||||
|
||||
description = 'Run the calibre test suite'
|
||||
|
||||
def add_options(self, parser):
|
||||
super().add_options(parser)
|
||||
parser.add_option('--test-verbosity', type=int, default=4, help='Test verbosity (0-4)')
|
||||
parser.add_option('--test-module', '--test-group', default=[], action='append', type='choice', choices=sorted(map(str, TEST_MODULES)),
|
||||
help='The test module to run (can be specified more than once for multiple modules). Choices: %s' % ', '.join(sorted(TEST_MODULES)))
|
||||
parser.add_option('--test-name', '-n', default=[], action='append',
|
||||
help='The name of an individual test to run. Can be specified more than once for multiple tests. The name of the'
|
||||
' test is the name of the test function without the leading test_. For example, the function test_something()'
|
||||
' can be run by specifying the name "something".')
|
||||
parser.add_option('--exclude-test-module', default=[], action='append', type='choice', choices=sorted(map(str, TEST_MODULES)),
|
||||
help='A test module to be excluded from the test run (can be specified more than once for multiple modules).'
|
||||
' Choices: %s' % ', '.join(sorted(TEST_MODULES)))
|
||||
parser.add_option('--exclude-test-name', default=[], action='append',
|
||||
help='The name of an individual test to be excluded from the test run. Can be specified more than once for multiple tests.')
|
||||
|
||||
def run(self, opts):
|
||||
super().run(opts)
|
||||
# cgi is used by feedparser and possibly other dependencies
|
||||
import warnings
|
||||
warnings.filterwarnings('ignore', message="'cgi' is deprecated and slated for removal in Python 3.13")
|
||||
@ -62,10 +70,14 @@ class Test(Command):
|
||||
run_cli(tests, verbosity=opts.test_verbosity, buffer=not opts.test_name)
|
||||
|
||||
|
||||
class TestRS(Command):
|
||||
class TestRS(BaseTest):
|
||||
|
||||
description = 'Run tests for RapydScript code'
|
||||
|
||||
def add_options(self, parser):
|
||||
super().add_options(parser)
|
||||
|
||||
def run(self, opts):
|
||||
super().run(opts)
|
||||
from calibre.utils.rapydscript import run_rapydscript_tests
|
||||
run_rapydscript_tests()
|
||||
|
Loading…
x
Reference in New Issue
Block a user