Move common test utility function to the top-level arborescence
It's shared amongst both package and core loaders.
This will avoid importing different helper utility functions from different modules.
This also fixes captured error on assert_last_visit_matches when the assertion is failing regarding the visit_status snapshot comparison.
Related to T2481
Test Plan
tox
Migrated from D3432 (view on Phabricator)