File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -66,10 +66,7 @@ test: generate install $(TESTDATA_FILE) ## Run unit tests
6666
6767.PHONY : conformance
6868conformance : $(BIN ) /protovalidate-conformance generate install # # Run conformance tests
69- rm test/__init__.py # the init is required for pytest to work, but confuses python when running a standard script
7069 $(BIN ) /protovalidate-conformance $(CONFORMANCE_ARGS ) uv run test/conformance/runner.py
71- touch test/__init__.py
72- $(ADD_LICENSE_HEADER )
7370
7471.PHONY : lint
7572lint : install $(BIN ) /buf # # Lint code
Original file line number Diff line number Diff line change 1414
1515import sys
1616import typing
17+ from pathlib import Path
1718
1819import celpy
1920from google .protobuf import any_pb2 , descriptor , descriptor_pool , message_factory
2021
2122import protovalidate
22- from test .gen .buf .validate .conformance .cases import (
23+
24+ # this is run as a standard python script, not via pytest, so we need to append the correct path to the sys.path
25+ # to make below import work. We can't use test.gen.buf.validate.conformance.cases because that would require an
26+ # __init__.py in every directory level.
27+ test_dir_path = Path (__file__ ).parent .parent .absolute ().as_posix ()
28+ if test_dir_path not in sys .path :
29+ sys .path .append (test_dir_path )
30+
31+ from gen .buf .validate .conformance .cases import (
2332 bool_pb2 , # noqa: F401
2433 bytes_pb2 , # noqa: F401
2534 enums_pb2 , # noqa: F401
5059 wkt_timestamp_pb2 , # noqa: F401
5160 wkt_wrappers_pb2 , # noqa: F401
5261)
53- from test . gen .buf .validate .conformance .cases .custom_rules import custom_rules_pb2 # noqa: F401
54- from test . gen .buf .validate .conformance .harness import harness_pb2
62+ from gen .buf .validate .conformance .cases .custom_rules import custom_rules_pb2 # noqa: F401
63+ from gen .buf .validate .conformance .harness import harness_pb2
5564
5665
5766def run_test_case (tc : typing .Any , result : harness_pb2 .TestResult | None = None ) -> harness_pb2 .TestResult :
You can’t perform that action at this time.
0 commit comments