Skip to content

Commit c50a40f

Browse files
Fix Makefile dependencies (#350)
Also, make sure we're checking formatting in the `lint` target. And fix a couple of comments.
1 parent 4bfd81a commit c50a40f

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ADD_LICENSE_HEADER := $(BIN)/license-header \
1818
# This version should be kept in sync with the version in buf.yaml
1919
PROTOVALIDATE_VERSION ?= v0.14.0
2020
# Version of the cel-spec that this implementation is conformant with
21-
# This should be kept in sync with the version in format_test.py
21+
# This should be kept in sync with the version in test/test_format.py
2222
CEL_SPEC_VERSION ?= v0.24.0
2323
TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION).textproto
2424

@@ -44,7 +44,7 @@ generate: $(BIN)/buf $(BIN)/license-header ## Regenerate code and license header
4444
$(ADD_LICENSE_HEADER)
4545

4646
.PHONY: format
47-
format: install $(BIN)/license-header ## Format code
47+
format: install $(BIN)/buf $(BIN)/license-header ## Format code
4848
$(ADD_LICENSE_HEADER)
4949
buf format --write .
5050
uv run -- ruff format protovalidate test
@@ -65,7 +65,8 @@ conformance: $(BIN)/protovalidate-conformance generate install ## Run conformanc
6565
protovalidate-conformance $(CONFORMANCE_ARGS) uv -- run python3 -m test.conformance.runner
6666

6767
.PHONY: lint
68-
lint: install ## Lint code
68+
lint: install $(BIN)/buf ## Lint code
69+
buf format -d --exit-code
6970
uv run -- ruff format --check --diff protovalidate test
7071
uv run -- mypy protovalidate
7172
uv run -- ruff check protovalidate test

test/test_format.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
from protovalidate.internal import extra_func
2727
from protovalidate.internal.cel_field_presence import InterpretedRunner
2828

29-
# Version of the cel-spec that this implementation is conformant with
30-
# This should be kept in sync with the version in the Makefile
29+
# Version of the cel-spec that this implementation is conformant with.
30+
# This should be kept in sync with the version in ../Makefile.
3131
CEL_SPEC_VERSION = "v0.24.0"
3232

3333
skipped_tests = [
@@ -36,6 +36,7 @@
3636
# This throws an error like:
3737
# "no such overload: IntType(0) <class 'celpy.celtypes.IntType'> !=
3838
# BoolType(False) <class 'celpy.celtypes.BoolType'>",))
39+
# TODO: Check if this bug is fixed in newer versions of cel-python.
3940
"map support (all key types)",
4041
]
4142
skipped_error_tests = [
@@ -111,8 +112,6 @@ def test_format_successes(self):
111112
prog = self._env.program(ast, functions=extra_func.make_extra_funcs())
112113

113114
bindings = build_variables(test.bindings)
114-
# Ideally we should use pytest parametrize instead of subtests, but
115-
# that would require refactoring other tests also.
116115
with self.subTest(test.name):
117116
try:
118117
result = prog.evaluate(bindings)
@@ -135,8 +134,6 @@ def test_format_errors(self):
135134
prog = self._env.program(ast, functions=extra_func.make_extra_funcs())
136135

137136
bindings = build_variables(test.bindings)
138-
# Ideally we should use pytest parametrize instead of subtests, but
139-
# that would require refactoring other tests also.
140137
with self.subTest(test.name):
141138
try:
142139
prog.evaluate(bindings)

0 commit comments

Comments
 (0)