Skip to content

Commit

Permalink
addressed PR notes from #807
Browse files Browse the repository at this point in the history
  • Loading branch information
ajohns committed Dec 4, 2019
1 parent 8eb5ba2 commit 4b7054a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/rez/cli/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def command(opts, parser, extra_arg_groups=None):
dry_run=opts.dry_run,
stop_on_fail=opts.stop_on_fail,
use_current_env=opts.inplace,
verbose=2
verbose=(3 if opts.verbose else 2)
)

test_names = runner.get_test_names()
Expand Down
25 changes: 20 additions & 5 deletions src/rez/package_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ def __init__(self, package_request, use_current_env=False,
self.context_kwargs = context_kwargs

if isinstance(verbose, bool):
self.verbose = 2 if verbose else 0
# backwards compat, verbose used to be bool
self.verbose = 3 if verbose else 0
else:
self.verbose = verbose

Expand Down Expand Up @@ -309,12 +310,26 @@ def run_test(self, test_name):
variant.variant_requires + on_variants["requires"])

if reqlist.conflict:
if self.verbose > 2:
self._add_test_result(
test_name,
variant,
"skipped",
"Test skipped as specified by on_variants.requires"
)
continue

# test if variant requires is a subset of on_variants.requires.
# This works because RequirementList merges requirements.
#
if RequirementList(variant.variant_requires) != reqlist:
if self.verbose > 2:
self._add_test_result(
test_name,
variant,
"skipped",
"Test skipped as specified by on_variants.requires"
)
continue

# show progress
Expand Down Expand Up @@ -366,9 +381,9 @@ def run_test(self, test_name):

if resolved_variant.handle != variant.handle:
print_warning(
"Could not resolve environment for this variant. This is a "
"known issue and will be fixed once 'explicit variant "
"selection' is added to rez."
"Could not resolve environment for this variant (%s). This "
"is a known issue and will be fixed once 'explicit variant "
"selection' is added to rez.", variant.uri
)

self._add_test_result(
Expand Down Expand Up @@ -571,7 +586,7 @@ def _get_target_variants(self, test_name):
# output would be confusing to the user.
#
context = self._get_context(requires, quiet=True)
if not context.success:
if context is None or not context.success:
continue

preferred_variant = context.get_resolved_package(package.name)
Expand Down

0 comments on commit 4b7054a

Please sign in to comment.