black: Reformat skipping string normalization.

This commit is contained in:
PIG208 2021-05-28 17:03:46 +08:00 committed by Tim Abbott
parent 5580c68ae5
commit fba21bb00d
178 changed files with 6562 additions and 4469 deletions

View file

@ -31,33 +31,37 @@ the tests for xkcd and wikipedia bots):
"""
parser = argparse.ArgumentParser(description=description)
parser.add_argument('bots_to_test',
metavar='bot',
nargs='*',
default=[],
help='specific bots to test (default is all)')
parser.add_argument('--coverage',
nargs='?',
const=True,
default=False,
help='compute test coverage (--coverage combine to combine with previous reports)')
parser.add_argument('--exclude',
metavar='bot',
nargs='*',
default=[],
help='bot(s) to exclude')
parser.add_argument('--error-on-no-init',
default=False,
action="store_true",
help="whether to exit if a bot has tests which won't run due to no __init__.py")
parser.add_argument('--pytest', '-p',
default=False,
action='store_true',
help="run tests with pytest")
parser.add_argument('--verbose', '-v',
default=False,
action='store_true',
help='show verbose output (with pytest)')
parser.add_argument(
'bots_to_test',
metavar='bot',
nargs='*',
default=[],
help='specific bots to test (default is all)',
)
parser.add_argument(
'--coverage',
nargs='?',
const=True,
default=False,
help='compute test coverage (--coverage combine to combine with previous reports)',
)
parser.add_argument('--exclude', metavar='bot', nargs='*', default=[], help='bot(s) to exclude')
parser.add_argument(
'--error-on-no-init',
default=False,
action="store_true",
help="whether to exit if a bot has tests which won't run due to no __init__.py",
)
parser.add_argument(
'--pytest', '-p', default=False, action='store_true', help="run tests with pytest"
)
parser.add_argument(
'--verbose',
'-v',
default=False,
action='store_true',
help='show verbose output (with pytest)',
)
return parser.parse_args()
@ -76,6 +80,7 @@ def main():
if options.coverage:
import coverage
cov = coverage.Coverage(config_file="tools/.coveragerc")
if options.coverage == 'combine':
cov.load()
@ -94,11 +99,11 @@ def main():
excluded_bots = ['merels']
pytest_bots_to_test = sorted([bot for bot in bots_to_test if bot not in excluded_bots])
pytest_options = [
'-s', # show output from tests; this hides the progress bar though
'-x', # stop on first test failure
'-s', # show output from tests; this hides the progress bar though
'-x', # stop on first test failure
'--ff', # runs last failure first
]
pytest_options += (['-v'] if options.verbose else [])
pytest_options += ['-v'] if options.verbose else []
os.chdir(bots_dir)
result = pytest.main(pytest_bots_to_test + pytest_options)
if result != 0:
@ -116,7 +121,9 @@ def main():
test_suites.append(loader.discover(top_level + name, top_level_dir=top_level))
except ImportError as exception:
print(exception)
print("This likely indicates that you need a '__init__.py' file in your bot directory.")
print(
"This likely indicates that you need a '__init__.py' file in your bot directory."
)
if options.error_on_no_init:
sys.exit(1)
@ -134,5 +141,6 @@ def main():
cov.html_report()
print("HTML report saved under directory 'htmlcov'.")
if __name__ == '__main__':
main()