[Webkit-unassigned] [Bug 221940] [LayoutTests] Convert http/tests/eventsource convert PHP to Python

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Feb 16 09:36:46 PST 2021


https://bugs.webkit.org/show_bug.cgi?id=221940

--- Comment #3 from Jonathan Bedard <jbedard at apple.com> ---
Comment on attachment 420407
  --> https://bugs.webkit.org/attachment.cgi?id=420407
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=420407&action=review

> LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:8
> +request_method = os.environ.get('REQUEST_METHOD')

I think we should do the request_method bit first.

> LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:11
> +    sys.exit('Got unexpected preflight request')

Python's sys.exit() prints to stderr, PHP's die prints to stdout. So we really want this to be:

sys.stdout.write('Content-Type: text/html\r\n\r\n')
sys.stdout.write('Got unexpected preflight request\n')
sys.exit(0)

> LayoutTests/http/tests/eventsource/resources/es-cors-basic.py:24
> +

If the count is 0 or 1, we aren't ending the header

> LayoutTests/http/tests/eventsource/resources/es-cors-credentials.py:9
> +    sys.exit('Got unexpected preflight request')

Ditto on the sys.exit() vs die()

> LayoutTests/http/tests/eventsource/resources/es-cors-credentials.py:17
> +returned_from_header = False

Unused variable

> LayoutTests/http/tests/eventsource/resources/es-eof.py:11
> +    'id: {}\n'

I think we want to use named variables in this string, gets to be a bit tough to follow

> LayoutTests/http/tests/eventsource/resources/infinite-event-stream.py:15
> +    data = {"time": curDate}

Nit: Should use single quotes

> LayoutTests/http/tests/eventsource/resources/status-codes.py:18
> +elif status_code == 301 or status_code == 302 or status_code == 303 or status_code == 307:

Should probably do: status_code in [301, 302, 303, 307] instead

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210216/1985cdaa/attachment-0001.htm>


More information about the webkit-unassigned mailing list