Skip to content

Commit 0b1a00e

Browse files
committed
Fix lint
1 parent 91771a8 commit 0b1a00e

File tree

1 file changed

+4
-13
lines changed
  • betterproto2/tests/conformance

1 file changed

+4
-13
lines changed

betterproto2/tests/conformance/main.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ProtocolError(Exception):
2121
def do_test(request: ConformanceRequest) -> ConformanceResponse:
2222
response = ConformanceResponse()
2323

24-
is_json = betterproto2.which_one_of(request, "payload")[0] == "json_payload"
24+
# is_json = betterproto2.which_one_of(request, "payload")[0] == "json_payload"
2525

2626
if request.message_type != "protobuf_test_messages.proto3.TestAllTypesProto3":
2727
return ConformanceResponse(skipped="non proto3 tests not supported")
@@ -46,11 +46,6 @@ def do_test(request: ConformanceRequest) -> ConformanceResponse:
4646

4747
elif betterproto2.which_one_of(request, "payload")[0] == "text_payload":
4848
return ConformanceResponse(skipped="text input not supported")
49-
try:
50-
text_format.Parse(request.text_payload, test_message)
51-
except Exception as e:
52-
response.parse_error = str(e)
53-
return response
5449

5550
else:
5651
raise ProtocolError("Request didn't have payload.")
@@ -85,12 +80,12 @@ def do_test_io():
8580
if len(length_bytes) == 0:
8681
return False # EOF
8782
elif len(length_bytes) != 4:
88-
raise IOError("I/O error")
83+
raise OSError("I/O error")
8984

9085
length = struct.unpack("<I", length_bytes)[0]
9186
serialized_request = sys.stdin.buffer.read(length)
9287
if len(serialized_request) != length:
93-
raise IOError("I/O error")
88+
raise OSError("I/O error")
9489

9590
request = ConformanceRequest.parse(serialized_request)
9691

@@ -117,10 +112,6 @@ def do_test_io():
117112

118113

119114
while True:
120-
# with open("/Users/adrienvannson/Documents/python-betterproto2/betterproto2/debug.txt", "a") as f:
121-
# f.write("Hello!")
122115
if not do_test_io():
123-
sys.stderr.write(
124-
"conformance_python: received EOF from test runner " + "after %s tests, exiting\n" % (test_count,)
125-
)
116+
print("conformance_python: received EOF from test runner after", test_count, "tests, exiting\n", file=sys.stderr)
126117
sys.exit(0)

0 commit comments

Comments
 (0)