scripts: Prefer 1;30-37m ansi codes over 90-97m

Reading Wikipedia:

> Later terminals added the ability to directly specify the "bright"
> colors with 90–97 and 100–107.

So if we want to stick to one pattern, we should probably go with
brightness as a separate modifier.

This shouldn't noticeably change any script, unless your terminal
interprets 90-97m colors differently from 1;30-37m, in which case things
should be more consistent now.
This commit is contained in:
Christopher Haster
2025-04-10 15:30:27 -05:00
parent cd039f6227
commit b715e9a749
8 changed files with 32 additions and 33 deletions

View File

@@ -162,7 +162,7 @@ class TestCase:
for k in config.keys():
print('%swarning:%s in %s, found unused key %r' % (
'\x1b[01;33m' if args['color'] else '',
'\x1b[1;33m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
self.name,
k),
@@ -276,7 +276,7 @@ class TestSuite:
for k in config.keys():
print('%swarning:%s in %s, found unused key %r' % (
'\x1b[01;33m' if args['color'] else '',
'\x1b[1;33m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
self.name,
k),
@@ -317,7 +317,7 @@ def compile(test_paths, **args):
if len(pending_) == len(pending):
print('%serror:%s cycle detected in suite ordering: {%s}' % (
'\x1b[01;31m' if args['color'] else '',
'\x1b[1;31m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
', '.join(suite.name for suite in pending.values())),
file=sys.stderr)
@@ -331,7 +331,7 @@ def compile(test_paths, **args):
for suite in suites:
if suite.name in seen:
print('%swarning:%s conflicting suite %r, %s and %s' % (
'\x1b[01;33m' if args['color'] else '',
'\x1b[1;33m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
suite.name,
suite.path,
@@ -345,7 +345,7 @@ def compile(test_paths, **args):
isinstance(seen[case.name], TestSuite)
and seen[case.name].cases == [case]):
print('%swarning:%s conflicting case %r, %s and %s' % (
'\x1b[01;33m' if args['color'] else '',
'\x1b[1;33m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
case.name,
case.path,
@@ -357,7 +357,7 @@ def compile(test_paths, **args):
if not args.get('source'):
if len(suites) > 1:
print('%serror:%s compiling more than one test suite? (%r)' % (
'\x1b[01;31m' if args['color'] else '',
'\x1b[1;31m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
test_paths),
file=sys.stderr)
@@ -913,7 +913,7 @@ def find_ids(runner, test_ids=[], **args):
# no suite/case found? error
if not test_ids__:
print('%serror:%s no tests match id %r?' % (
'\x1b[01;31m' if args['color'] else '',
'\x1b[1;31m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
id),
file=sys.stderr)
@@ -1381,7 +1381,7 @@ def run(runner, test_ids=[], **args):
print('%s%s:%d:%sfailure:%s %s%s failed' % (
'\x1b[01m' if args['color'] else '',
path, lineno,
'\x1b[01;31m' if args['color'] else '',
'\x1b[1;31m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
failure.id,
' (%s)' % ', '.join('%s=%s' % (k,v)
@@ -1400,7 +1400,7 @@ def run(runner, test_ids=[], **args):
print('%s%s:%d:%sassert:%s %s' % (
'\x1b[01m' if args['color'] else '',
path, lineno,
'\x1b[01;31m' if args['color'] else '',
'\x1b[1;31m' if args['color'] else '',
'\x1b[m' if args['color'] else '',
message))
with open(path) as f: