• 
      

    Fix a string type issue in ShellCheck and generally in unit tests.

    Review Request #12891 — Created March 14, 2023 and submitted

    Information

    ReviewBot
    release-3.x

    Reviewers

    In production on Python 3, ShellCheck would fail due to a string type
    issue when trying to build replacement strings. This was missed in unit
    tests due to an assumption being made that byte strings are appropriate
    for diff content in "diff data" result from the API, when in fact those
    must be Unicode strings, since the result is JSON (and encoding is
    handled on the Review Board side).

    Addressing this required fixing up the mismatch in the ShellCheck code,
    and also updating the unit test helpers run_tool_execute() and
    run_get_can_handle_file() to convert any sample bytestring content to
    Unicode when building up a diff data payload.

    Unit tests pass on all supported versions of Python.

    Verified the ShellCheck fix with a customer.

    Summary ID
    Fix a string type issue in ShellCheck and generally in unit tests.
    In production on Python 3, ShellCheck would fail due to a string type issue when trying to build replacement strings. This was missed in unit tests due to an assumption being made that byte strings are appropriate for diff content in "diff data" result from the API, when in fact those must be Unicode strings, since the result is JSON (and encoding is handled on the Review Board side). Addressing this required fixing up the mismatch in the ShellCheck code, and also updating the unit test helpers `run_tool_execute()` and `run_get_can_handle_file()` to convert any sample bytestring content to Unicode when building up a diff data payload.
    569356ddcd1114f473bf1cd36b650a7627d0265b
    david
    1. Ship It!
    2. 
        
    maubin
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-3.x (37347fe)