Move common test utility function to the top-level arborescence
It's shared amongst both package and core loaders.
Related to T2481