Skip to content

Commit

Permalink
Merge 44ffa0e into a3139c0
Browse files Browse the repository at this point in the history
  • Loading branch information
mtreinish committed Jul 16, 2019
2 parents a3139c0 + 44ffa0e commit cbee21a
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 23 deletions.
10 changes: 6 additions & 4 deletions doc/source/MANUAL.rst
Expand Up @@ -210,10 +210,12 @@ is also possible that a test has other text attachments (a common example is
python logging) which are not printed on successful test execution, only on
failures. If you would like to have these attachments also printed for
successful tests you can use the ``--all-attachments`` flag to print all text
attachments on both successful and failed tests. If both ``--all-attachments``
and ``--suppress-attachments`` are set then the ``--suppress--attachments``
flag will take priority and no attachments will be printed for successful
tests.
attachments on both successful and failed tests. Both ``--all-attachments``
and ``--suppress-attachments`` can not be set at the same time. If both are
set in the user config file then the ``suppress-attachments`` flag will take
priority and no attachments will be printed for successful tests. If either
``--suppress-attachments`` or ``--all-attachments`` is set via the CLI it
will take precedence over matching options set in the user config file.

Combining Test Results
----------------------
Expand Down
25 changes: 19 additions & 6 deletions stestr/commands/last.py
Expand Up @@ -70,6 +70,12 @@ def get_parser(self, prog_name):
def take_action(self, parsed_args):
user_conf = user_config.get_user_config(self.app_args.user_config)
args = parsed_args
if args.suppress_attachments and args.all_attachments:
msg = ("The --suppress-attachments and --all-attachments "
"options are mutually exclusive, you can not use both "
"at the same time")
print(msg)
sys.exit(1)
if getattr(user_conf, 'last', False):
if not user_conf.last.get('no-subunit-trace'):
if not args.no_subunit_trace:
Expand All @@ -80,12 +86,19 @@ def take_action(self, parsed_args):
pretty_out = False
pretty_out = args.force_subunit_trace or pretty_out
color = args.color or user_conf.last.get('color', False)
suppress_attachments = (
args.suppress_attachments or user_conf.last.get(
'suppress-attachments', False))
all_attachments = (
args.all_attachments or user_conf.last.get(
'all-attachments', False))
suppress_attachments_conf = user_conf.run.get(
'suppress-attachments', False)
all_attachments_conf = user_conf.run.get(
'all-attachments', False)
if not args.suppress_attachments and not args.all_attachments:
suppress_attachments = suppress_attachments_conf
all_attachments = all_attachments_conf
elif args.suppress_attachments:
all_attachments = False
suppress_attachments = args.suppress_attachments
elif args.all_attachments:
suppress_attachments = False
all_attachments = args.all_attachments
else:
pretty_out = args.force_subunit_trace or not args.no_subunit_trace
color = args.color
Expand Down
25 changes: 19 additions & 6 deletions stestr/commands/load.py
Expand Up @@ -90,6 +90,12 @@ def get_parser(self, prog_name):
def take_action(self, parsed_args):
user_conf = user_config.get_user_config(self.app_args.user_config)
args = parsed_args
if args.suppress_attachments and args.all_attachments:
msg = ("The --suppress-attachments and --all-attachments "
"options are mutually exclusive, you can not use both "
"at the same time")
print(msg)
sys.exit(1)
if getattr(user_conf, 'load', False):
force_init = args.force_init or user_conf.load.get('force-init',
False)
Expand All @@ -98,12 +104,19 @@ def take_action(self, parsed_args):
color = args.color or user_conf.load.get('color', False)
abbreviate = args.abbreviate or user_conf.load.get('abbreviate',
False)
suppress_attachments = (
args.suppress_attachments or user_conf.load.get(
'suppress-attachments', False))
all_attachments = (
args.all_attachments or user_conf.load.get(
'all-attachments', False))
suppress_attachments_conf = user_conf.run.get(
'suppress-attachments', False)
all_attachments_conf = user_conf.run.get(
'all-attachments', False)
if not args.suppress_attachments and not args.all_attachments:
suppress_attachments = suppress_attachments_conf
all_attachments = all_attachments_conf
elif args.suppress_attachments:
all_attachments = False
suppress_attachments = args.suppress_attachments
elif args.all_attachments:
suppress_attachments = False
all_attachments = args.all_attachments
else:
force_init = args.force_init
pretty_out = args.subunit_trace
Expand Down
26 changes: 19 additions & 7 deletions stestr/commands/run.py
Expand Up @@ -162,6 +162,12 @@ def take_action(self, parsed_args):
user_conf = user_config.get_user_config(self.app_args.user_config)
filters = parsed_args.filters
args = parsed_args
if args.suppress_attachments and args.all_attachments:
msg = ("The --suppress-attachments and --all-attachments "
"options are mutually exclusive, you can not use both "
"at the same time")
print(msg)
sys.exit(1)
if getattr(user_conf, 'run', False):
if not user_conf.run.get('no-subunit-trace'):
if not args.no_subunit_trace:
Expand All @@ -180,13 +186,19 @@ def take_action(self, parsed_args):
color = args.color or user_conf.run.get('color', False)
abbreviate = args.abbreviate or user_conf.run.get(
'abbreviate', False)
suppress_attachments = (
args.suppress_attachments or user_conf.run.get(
'suppress-attachments', False))
all_attachments = (
args.all_attachments or user_conf.run.get(
'all-attachments', False))

suppress_attachments_conf = user_conf.run.get(
'suppress-attachments', False)
all_attachments_conf = user_conf.run.get(
'all-attachments', False)
if not args.suppress_attachments and not args.all_attachments:
suppress_attachments = suppress_attachments_conf
all_attachments = all_attachments_conf
elif args.suppress_attachments:
all_attachments = False
suppress_attachments = args.suppress_attachments
elif args.all_attachments:
suppress_attachments = False
all_attachments = args.all_attachments
else:
pretty_out = args.force_subunit_trace or not args.no_subunit_trace
concurrency = args.concurrency or 0
Expand Down

0 comments on commit cbee21a

Please sign in to comment.