diff --git a/src/rez/data/tests/solver/packages/missing_variant_package/1/package.py b/src/rez/data/tests/solver/packages/missing_variant_package/1/package.py new file mode 100644 index 000000000..20a06feef --- /dev/null +++ b/src/rez/data/tests/solver/packages/missing_variant_package/1/package.py @@ -0,0 +1,10 @@ +name = "missing_variant_package" +version = "1" + +def commands(): + pass + +variants = [ + ["noexist"], + ["nada"] +] \ No newline at end of file diff --git a/src/rez/tests/test_solver.py b/src/rez/tests/test_solver.py index 6422bcf07..1c229911c 100644 --- a/src/rez/tests/test_solver.py +++ b/src/rez/tests/test_solver.py @@ -7,6 +7,7 @@ """ from __future__ import print_function +import rez.exceptions from rez.vendor.version.requirement import Requirement from rez.solver import Solver, Cycle, SolverStatus from rez.config import config @@ -248,6 +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) + with self.assertRaises(rez.exceptions.PackageFamilyNotFoundError): + self._solve(["missing_variant_package"], []) + + config.override("error_on_missing_variant_packages", False) + self._solve(["missing_variant_package"], ["nada[]", "missing_variant_package-1[1]"]) if __name__ == '__main__': unittest.main()