From 9213fe4c6a032b7196303560c6ab8b9572cd07e8 Mon Sep 17 00:00:00 2001 From: Stefan VanBuren Date: Fri, 15 Aug 2025 15:53:22 -0400 Subject: [PATCH] Fix Makefile dependencies Also, make sure we're checking formatting in the `lint` target. And fix a couple of comments. --- Makefile | 7 ++++--- test/test_format.py | 9 +++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 4614c836..103e5bdb 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ ADD_LICENSE_HEADER := $(BIN)/license-header \ # This version should be kept in sync with the version in buf.yaml PROTOVALIDATE_VERSION ?= v0.14.0 # Version of the cel-spec that this implementation is conformant with -# This should be kept in sync with the version in format_test.py +# This should be kept in sync with the version in test/test_format.py CEL_SPEC_VERSION ?= v0.24.0 TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION).textproto @@ -44,7 +44,7 @@ generate: $(BIN)/buf $(BIN)/license-header ## Regenerate code and license header $(ADD_LICENSE_HEADER) .PHONY: format -format: install $(BIN)/license-header ## Format code +format: install $(BIN)/buf $(BIN)/license-header ## Format code $(ADD_LICENSE_HEADER) buf format --write . uv run -- ruff format protovalidate test @@ -65,7 +65,8 @@ conformance: $(BIN)/protovalidate-conformance generate install ## Run conformanc protovalidate-conformance $(CONFORMANCE_ARGS) uv -- run python3 -m test.conformance.runner .PHONY: lint -lint: install ## Lint code +lint: install $(BIN)/buf ## Lint code + buf format -d --exit-code uv run -- ruff format --check --diff protovalidate test uv run -- mypy protovalidate uv run -- ruff check protovalidate test diff --git a/test/test_format.py b/test/test_format.py index 99db67da..3da9fd9a 100644 --- a/test/test_format.py +++ b/test/test_format.py @@ -26,8 +26,8 @@ from protovalidate.internal import extra_func from protovalidate.internal.cel_field_presence import InterpretedRunner -# Version of the cel-spec that this implementation is conformant with -# This should be kept in sync with the version in the Makefile +# Version of the cel-spec that this implementation is conformant with. +# This should be kept in sync with the version in ../Makefile. CEL_SPEC_VERSION = "v0.24.0" skipped_tests = [ @@ -36,6 +36,7 @@ # This throws an error like: # "no such overload: IntType(0) != # BoolType(False) ",)) + # TODO: Check if this bug is fixed in newer versions of cel-python. "map support (all key types)", ] skipped_error_tests = [ @@ -111,8 +112,6 @@ def test_format_successes(self): prog = self._env.program(ast, functions=extra_func.make_extra_funcs()) bindings = build_variables(test.bindings) - # Ideally we should use pytest parametrize instead of subtests, but - # that would require refactoring other tests also. with self.subTest(test.name): try: result = prog.evaluate(bindings) @@ -135,8 +134,6 @@ def test_format_errors(self): prog = self._env.program(ast, functions=extra_func.make_extra_funcs()) bindings = build_variables(test.bindings) - # Ideally we should use pytest parametrize instead of subtests, but - # that would require refactoring other tests also. with self.subTest(test.name): try: prog.evaluate(bindings)