Jeff Armstrong has enhanced the Schur decomposition function scipy.linalg.schur to expose the ability to sort the eigenvalues (more accurately, group them according to a boolean function); see https://github.com/scipy/scipy/pull/23.  schur() is a wrapper for the DGEES Fortran library function.  According to its documentation, if the matrix is poorly scaled, the eigenvalues can fail to satisfy the sorting condition *after* they've been sorted, because of rounding errors.  The function returns an error code when this occurs.

Jeff's code checks for this condition, and he also added a couple unit tests for it.  Unfortunately, the tests fail on my computer--that is, the error condition does not happen.  This is not surprising, as the error condition relies on the behavior of rounding errors.  So, to the question:  is there a way to make these tests platform-dependent, so that they only run on a platform/architecture/whatever where the tests are known to trigger the desired condition?  Or is the result likely to depend on so many other factors (compiler and optimization settings, third party math library, phase of the moon, etc) that it is hopeless to try?

Warren