Skip to content

Commit

Permalink
Merge d108b71 into 8ebb3aa
Browse files Browse the repository at this point in the history
  • Loading branch information
ochaplashkin committed Sep 18, 2023
2 parents 8ebb3aa + d108b71 commit 50798f3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/luatest_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def execute(self, server):
project_dir = os.environ['SOURCEDIR']

with open(server.logfile, 'ab') as f:
proc = Popen(command, cwd=project_dir, stdout=sys.stdout, stderr=f)
stderr = f
if Options().args.show_capture:
stderr = sys.stdout
proc = Popen(command, cwd=project_dir, stdout=sys.stdout, stderr=stderr)
sampler.register_process(proc.pid, self.id, server.name)
test_timeout = Options().args.test_timeout
timer = Timer(test_timeout, timeout_handler, (proc, test_timeout))
Expand Down
26 changes: 25 additions & 1 deletion lib/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ def format_help(s):
return textwrap.dedent(s.lstrip('\n')) + '\n'


class DeprecationWarning(argparse._StoreTrueAction):
"""Сustom definition of the 'store_true' procedure"""

def __call__(self, parser, namespace, values, option_string=None):
color_stdout(
"Argument %s is deprecated and is ignored.\n" % self.option_strings,
schema='info'
)
setattr(namespace, self.dest, values)


class Options(object):
"""Handle options of test-runner"""

Expand Down Expand Up @@ -126,15 +137,28 @@ def __init__(self):
parser.add_argument(
"--verbose",
dest='is_verbose',
action="store_true",
action=DeprecationWarning,
default=False,
help=format_help(
"""
Deprecated.
Print TAP13 test output to log.
Default: false.
"""))

parser.add_argument(
"-c", "--show-capture",
dest='show_capture',
action='store_true',
default=False,
help=format_help(
"""
Whether to show captured TAP13 output or not.
Default: false.
"""))

parser.add_argument(
'--debug',
dest='debug',
Expand Down
2 changes: 1 addition & 1 deletion lib/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def run(self, server):
self.is_equal_result = filecmp.cmp(self.result,
self.tmp_result)
elif self.is_executed_ok:
if Options().args.is_verbose:
if Options().args.show_capture:
color_stdout('\n')
with open(self.tmp_result, 'r') as f:
color_stdout(f.read(), schema='log')
Expand Down

0 comments on commit 50798f3

Please sign in to comment.