From c21868634d4be4f28f91add1013d8074cfac051e Mon Sep 17 00:00:00 2001 From: Dhruv Govil Date: Fri, 20 Oct 2023 14:20:22 -0700 Subject: [PATCH] Add tests for missing_variant_package --- .../packages/missing_variant_package/1/package.py | 10 ++++++++++ src/rez/tests/test_solver.py | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/rez/data/tests/solver/packages/missing_variant_package/1/package.py 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 0000000000..20a06feef1 --- /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 6422bcf07e..1c229911c4 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()