black: Reformat without skipping string normalization.

This commit is contained in:
PIG208 2021-05-28 17:05:11 +08:00 committed by Tim Abbott
parent fba21bb00d
commit 6f3f9bf7e4
178 changed files with 5242 additions and 5242 deletions

View file

@ -13,45 +13,45 @@ os.chdir(os.path.dirname(TOOLS_DIR))
def handle_input_and_run_tests_for_package(package_name, path_list):
parser = argparse.ArgumentParser(description="Run tests for {}.".format(package_name))
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(
'--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)",
)
options = parser.parse_args()
test_session_title = ' Running tests for {} '.format(package_name)
header = test_session_title.center(shutil.get_terminal_size().columns, '#')
test_session_title = " Running tests for {} ".format(package_name)
header = test_session_title.center(shutil.get_terminal_size().columns, "#")
print(header)
if options.coverage:
import coverage
cov = coverage.Coverage(config_file="tools/.coveragerc")
if options.coverage == 'combine':
if options.coverage == "combine":
cov.load()
cov.start()
if options.pytest:
location_to_run_in = os.path.join(TOOLS_DIR, '..', *path_list)
paths_to_test = ['.']
location_to_run_in = os.path.join(TOOLS_DIR, "..", *path_list)
paths_to_test = ["."]
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(location_to_run_in)
result = pytest.main(paths_to_test + pytest_options)
if result != 0: