Skip to content

Commit dbdecb0

Browse files
authored
Catch all exceptions in conformance runner.py (#282)
1 parent b1aa572 commit dbdecb0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tests/conformance/nonconforming.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,25 @@ standard_constraints/well_known_types/duration:
77
standard_constraints/well_known_types/timestamp:
88
- gte_lte/invalid/above
99
- lte/invalid
10+
11+
library/is_ip:
12+
- version/omitted/invalid/ipv6/g
13+
# input: [type.googleapis.com/buf.validate.conformance.cases.IsIp]:{val:":0::0"}
14+
# want: validation error (1 violation)
15+
# 1. constraint_id: "library.is_ip"
16+
# got: valid
17+
- version/omitted/invalid/ipv6/h
18+
# input: [type.googleapis.com/buf.validate.conformance.cases.IsIp]:{val:"0::0:"}
19+
# want: validation error (1 violation)
20+
# 1. constraint_id: "library.is_ip"
21+
# got: valid
22+
- version/omitted/invalid/ipv6/i
23+
# input: [type.googleapis.com/buf.validate.conformance.cases.IsIp]:{val:"0::0:"}
24+
# want: validation error (1 violation)
25+
# 1. constraint_id: "library.is_ip"
26+
# got: valid
27+
- version/omitted/invalid/ipv6/j
28+
# input: [type.googleapis.com/buf.validate.conformance.cases.IsIp]:{val:"::0000ffff"}
29+
# want: validation error (1 violation)
30+
# 1. constraint_id: "library.is_ip"
31+
# got: unexpected error: string index out of range

tests/conformance/runner.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def run_test_case(tc: typing.Any, result: typing.Optional[harness_pb2.TestResult
7272
result.runtime_error = str(e)
7373
except protovalidate.CompilationError as e:
7474
result.compilation_error = str(e)
75+
except Exception as e:
76+
result.unexpected_error = str(e)
7577
return result
7678

7779

0 commit comments

Comments
 (0)