mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-14 14:03:58 +00:00
Import latest littlecheck
Commit b2f40783a2b5b0663409c4daa90b794b02dd37a6 This has better progress reporting, and the exit status of littlecheck indicates how many test failures there were.
This commit is contained in:
parent
1e2e511570
commit
11c1491e5a
1 changed files with 14 additions and 8 deletions
|
@ -6,6 +6,7 @@ from __future__ import unicode_literals
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
|
import datetime
|
||||||
import io
|
import io
|
||||||
import re
|
import re
|
||||||
import shlex
|
import shlex
|
||||||
|
@ -182,10 +183,7 @@ class TestFailure(object):
|
||||||
]
|
]
|
||||||
if self.after:
|
if self.after:
|
||||||
fields["additional_output"] = " ".join(self.after[:afterlines])
|
fields["additional_output"] = " ".join(self.after[:afterlines])
|
||||||
fmtstrs += [
|
fmtstrs += [" additional output:", " {BOLD}{additional_output}{RESET}"]
|
||||||
" additional output:",
|
|
||||||
" {BOLD}{additional_output}{RESET}",
|
|
||||||
]
|
|
||||||
fmtstrs += [" when running command:", " {subbed_command}"]
|
fmtstrs += [" when running command:", " {subbed_command}"]
|
||||||
return "\n".join(fmtstrs).format(**fields)
|
return "\n".join(fmtstrs).format(**fields)
|
||||||
|
|
||||||
|
@ -470,7 +468,7 @@ def main():
|
||||||
def_subs = {"%": "%"}
|
def_subs = {"%": "%"}
|
||||||
def_subs.update(parse_subs(args.substitute))
|
def_subs.update(parse_subs(args.substitute))
|
||||||
|
|
||||||
success = True
|
failure_count = 0
|
||||||
config = Config()
|
config = Config()
|
||||||
config.colorize = sys.stdout.isatty()
|
config.colorize = sys.stdout.isatty()
|
||||||
config.progress = args.progress
|
config.progress = args.progress
|
||||||
|
@ -480,13 +478,21 @@ def main():
|
||||||
fields["path"] = path
|
fields["path"] = path
|
||||||
if config.progress:
|
if config.progress:
|
||||||
print("Testing file {path} ... ".format(**fields), end="")
|
print("Testing file {path} ... ".format(**fields), end="")
|
||||||
|
sys.stdout.flush()
|
||||||
subs = def_subs.copy()
|
subs = def_subs.copy()
|
||||||
subs["s"] = path
|
subs["s"] = path
|
||||||
|
starttime = datetime.datetime.now()
|
||||||
if not check_path(path, subs, config, TestFailure.print_message):
|
if not check_path(path, subs, config, TestFailure.print_message):
|
||||||
success = False
|
failure_count += 1
|
||||||
elif config.progress:
|
elif config.progress:
|
||||||
print("{GREEN}ok{RESET}".format(**fields))
|
endtime = datetime.datetime.now()
|
||||||
sys.exit(0 if success else 1)
|
duration_ms = round((endtime - starttime).total_seconds() * 1000)
|
||||||
|
print(
|
||||||
|
"{GREEN}ok{RESET} ({duration} ms)".format(
|
||||||
|
duration=duration_ms, **fields
|
||||||
|
)
|
||||||
|
)
|
||||||
|
sys.exit(failure_count)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue