Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
21 changes: 19 additions & 2 deletions release/cel_basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"""Basic tests for cel-python."""

import importlib.metadata
import os
import sys
import unittest

from cel_expr_python import cel
Expand Down Expand Up @@ -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)")
Expand Down Expand Up @@ -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"])
Expand Down
Loading