Skip to content

Commit

Permalink
Address notes, fix tests
Browse files Browse the repository at this point in the history
Signed-off-by: Dhruv Govil <[email protected]>
  • Loading branch information
dgovil committed Oct 21, 2023
1 parent de55d7f commit 3aa2b5c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/rez/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def _parse_env_var(self, value):
"alias_back": OptionalStr,
"package_preprocess_function": OptionalStrOrFunction,
"package_preprocess_mode": PreprocessMode_,
"error_on_missing_variant_packages": Bool,
"error_on_missing_variant_requires": Bool,
"context_tracking_host": OptionalStr,
"variant_shortlinks_dirname": OptionalStr,
"build_thread_count": BuildThreadCount_,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name = "missing_variant_package"
name = "missing_variant_requires"
version = "1"

def commands():
Expand Down
4 changes: 2 additions & 2 deletions src/rez/rezconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,11 +657,11 @@
# - "override": Package's preprocess function completely overrides the global preprocess.
package_preprocess_mode = "override"

# Defines whether a resolve should immediately fail if any variants have a package that can't be found.
# Defines whether a resolve should immediately fail if any variants have a required package that can't be found.
# It is enabled by default.
# If disabled, it will try other variants before giving up.
# This can be useful if you have variants that aren't available to all users.
error_on_missing_variant_packages = True
error_on_missing_variant_requires = True

###############################################################################
# Context Tracking
Expand Down
2 changes: 1 addition & 1 deletion src/rez/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ def _create_phase(status=None):
requested = ", ".join(requesters)

fail_message = "package family not found: {}, was required by: {} (searched: {})".format(req.name, requested, searched)
if not config.error_on_missing_variant_packages:
if not config.error_on_missing_variant_requires:
print(fail_message, file=sys.stderr)
return _create_phase(SolverStatus.failed)
raise PackageFamilyNotFoundError(
Expand Down
2 changes: 1 addition & 1 deletion src/rez/tests/test_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def _eq(prefix, expected_completions):
_eq("", ["bahish", "nada", "nopy", "pybah", "pydad", "pyfoo", "pymum",
"pyodd", "pyson", "pysplit", "python", "pyvariants",
"test_variant_split_start", "test_variant_split_mid1",
"test_variant_split_mid2", "test_variant_split_end", "missing_variant_package"])
"test_variant_split_mid2", "test_variant_split_end", "missing_variant_requires"])
_eq("py", ["pybah", "pydad", "pyfoo", "pymum", "pyodd", "pyson",
"pysplit", "python", "pyvariants"])
_eq("pys", ["pyson", "pysplit"])
Expand Down
2 changes: 1 addition & 1 deletion src/rez/tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
'timestamped-1.0.5', 'timestamped-1.0.6', 'timestamped-1.1.0', 'timestamped-1.1.1',
'timestamped-1.2.0', 'timestamped-2.0.0', 'timestamped-2.1.0', 'timestamped-2.1.5',
'multi-1.0', 'multi-1.1', 'multi-1.2', 'multi-2.0',
'missing_variant_package-1'
'missing_variant_requires-1'
])


Expand Down
10 changes: 5 additions & 5 deletions src/rez/tests/test_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ def test_11_variant_splitting(self):
"test_variant_split_mid2-2.0[0]",
"test_variant_split_start-1.0[1]"])

def test_12_missing_variant_package(self):
config.override("error_on_missing_variant_packages", True)
def test_12_missing_variant_requires(self):
config.override("error_on_missing_variant_requires", True)
with self.assertRaises(rez.exceptions.PackageFamilyNotFoundError):
self._solve(["missing_variant_package"], [])
self._solve(["missing_variant_requires"], [])

config.override("error_on_missing_variant_packages", False)
self._solve(["missing_variant_package"], ["nada[]", "missing_variant_package-1[1]"])
config.override("error_on_missing_variant_requires", False)
self._solve(["missing_variant_requires"], ["nada[]", "missing_variant_requires-1[1]"])

if __name__ == '__main__':
unittest.main()

0 comments on commit 3aa2b5c

Please sign in to comment.