In order to save time on sorting, I decided to pre-sort application-level hooks (line 200), so that it wasn't happening on every request.  This means that the hooks you define in {yourapp}.app are frozen in priority *at startup time*.

This test was creating a Pecan WSGI app that had hooks with *no* priorities set, then modifying the attributes of the WSGI app's hooks at runtime, *then* testing that the run order changed.  Since they'd been presorted at application startup time, the test failed.  In general, people won't/shouldn't do this in practice through e.g., a controller, namely because it's not a very realistic/thread-safe thing to do.

So my suggestion is that it's worth losing the ability to modify *application-level* hook priorities at run time for the sake of saving an expensive sort on *every* new request.  That said, you can *still* modify the priorities of hooks that are defined at a controller level (which is something I *could* see people realistically attempting to do).