black: Reformat without skipping string normalization.
This commit is contained in:
parent
fba21bb00d
commit
6f3f9bf7e4
178 changed files with 5242 additions and 5242 deletions
|
@ -32,35 +32,35 @@ the tests for xkcd and wikipedia bots):
|
|||
parser = argparse.ArgumentParser(description=description)
|
||||
|
||||
parser.add_argument(
|
||||
'bots_to_test',
|
||||
metavar='bot',
|
||||
nargs='*',
|
||||
"bots_to_test",
|
||||
metavar="bot",
|
||||
nargs="*",
|
||||
default=[],
|
||||
help='specific bots to test (default is all)',
|
||||
help="specific bots to test (default is all)",
|
||||
)
|
||||
parser.add_argument(
|
||||
'--coverage',
|
||||
nargs='?',
|
||||
"--coverage",
|
||||
nargs="?",
|
||||
const=True,
|
||||
default=False,
|
||||
help='compute test coverage (--coverage combine to combine with previous reports)',
|
||||
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("--exclude", metavar="bot", nargs="*", default=[], help="bot(s) to exclude")
|
||||
parser.add_argument(
|
||||
'--error-on-no-init',
|
||||
"--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"
|
||||
"--pytest", "-p", default=False, action="store_true", help="run tests with pytest"
|
||||
)
|
||||
parser.add_argument(
|
||||
'--verbose',
|
||||
'-v',
|
||||
"--verbose",
|
||||
"-v",
|
||||
default=False,
|
||||
action='store_true',
|
||||
help='show verbose output (with pytest)',
|
||||
action="store_true",
|
||||
help="show verbose output (with pytest)",
|
||||
)
|
||||
return parser.parse_args()
|
||||
|
||||
|
@ -69,8 +69,8 @@ def main():
|
|||
TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
os.chdir(os.path.dirname(TOOLS_DIR))
|
||||
sys.path.insert(0, TOOLS_DIR)
|
||||
bots_dir = os.path.join(TOOLS_DIR, '..', 'zulip_bots/zulip_bots/bots')
|
||||
glob_pattern = bots_dir + '/*/test_*.py'
|
||||
bots_dir = os.path.join(TOOLS_DIR, "..", "zulip_bots/zulip_bots/bots")
|
||||
glob_pattern = bots_dir + "/*/test_*.py"
|
||||
test_modules = glob.glob(glob_pattern)
|
||||
|
||||
# get only the names of bots that have tests
|
||||
|
@ -82,7 +82,7 @@ def main():
|
|||
import coverage
|
||||
|
||||
cov = coverage.Coverage(config_file="tools/.coveragerc")
|
||||
if options.coverage == 'combine':
|
||||
if options.coverage == "combine":
|
||||
cov.load()
|
||||
cov.start()
|
||||
|
||||
|
@ -96,14 +96,14 @@ def main():
|
|||
bots_to_test = {bot for bot in specified_bots if bot not in options.exclude}
|
||||
|
||||
if options.pytest:
|
||||
excluded_bots = ['merels']
|
||||
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
|
||||
'--ff', # runs last failure first
|
||||
"-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:
|
||||
|
@ -142,5 +142,5 @@ def main():
|
|||
print("HTML report saved under directory 'htmlcov'.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue