Moving compat stuff exclusively for unit tests to its own file.