In general, it is a good idea to have each installation script be a separate transaction, since it makes the installation process more atomic. Currently, scripts files do not start and end transactions, which means that if an error occurs, any prior commands are not rolled back, which leaves the product in a partially-installed state.
For most (possibly all) script files, this simply involves adding a START TRANSACTION command at the start of the script, and a COMMIT command at the end.
A similar practice could be implemented for test scripts, but with a ROLLBACK command at the end of the file instead.
On a related note, a few scripts suppress warnings using the command SET LOCAL client_min_messages TO WARNING;. However, this command can actually only be used within a transaction, which results in a separate warning during installation. Having the scripts be in a transaction would address this minor issue as well.