diff --git a/MODULE.bazel b/MODULE.bazel index e8b0f28..bf1f084 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -17,6 +17,11 @@ bazel_dep(name = "bazel_skylib", version = "1.9.0") # https://registry.bazel.build/modules/cel-cpp bazel_dep(name = "cel-cpp", version = "0.17.0", repo_name = "com_google_cel_cpp") +git_override( + module_name = "cel-cpp", + commit = "9a6fd8ce1222209824c471306fa7f352faeff0d9", + remote = "https://github.com/cel-expr/cel-cpp", +) # https://registry.bazel.build/modules/cel-spec bazel_dep(name = "cel-spec", version = "0.25.3", repo_name = "com_google_cel_spec") diff --git a/release/cel_basic_test.py b/release/cel_basic_test.py index 99fa652..d962f42 100644 --- a/release/cel_basic_test.py +++ b/release/cel_basic_test.py @@ -15,6 +15,8 @@ """Basic tests for cel-python.""" import importlib.metadata +import os +import sys import unittest from cel_expr_python import cel @@ -64,7 +66,7 @@ def test_standard_extensions(self): # Test lists expr = env.compile("lists.range(3)") - self.assertEqual(expr.eval().value(), [0, 1, 2]) + self.assertEqual(expr.eval().plain_value(), [0, 1, 2]) # Test math expr = env.compile("math.greatest(1, 5, 3)") @@ -125,7 +127,22 @@ def test_custom_extension(self): self.assertEqual(res.value(), "Hello, world! Hi, CEL!") def test_wheel_package_contents(self): - dist = importlib.metadata.distribution("cel-expr-python") + # Exclude the script's own directory (which may be the build directory + # containing a source `.egg-info`) so we inspect the installed wheel's + # `.dist-info` distribution in site-packages. + script_dir = os.path.realpath(os.path.dirname(os.path.abspath(__file__))) + search_paths = [ + p for p in sys.path if p and os.path.realpath(p) != script_dir + ] + dists = list( + importlib.metadata.distributions( + name="cel-expr-python", path=search_paths + ) + ) + self.assertTrue( + dists, "Could not find installed cel-expr-python distribution" + ) + dist = dists[0] top_level = dist.read_text("top_level.txt") if top_level is not None: self.assertEqual(top_level.strip().splitlines(), ["cel_expr_python"])