package loaders: Make test failures more helpful
Some tests did the following:
- build a snapshot
- get the snapshot from the storage
- compare it with the expected snapshot
- get the origin visit from the storage and check it
If the loader built a wrong snapshot, the test fails at step 2, and the only information displayed is that the expected snapshot id does not exist, which is very unhelpful.
Instead, I reordered them as: 1, 4, 2, 3. This way, if a wrong snapshot is build by the loader, it is detected when comparing the visit, and pytest shows the two hashes. Then, the test can be modified to use the hash that is actually generated to show the actual snapshot.
This is consistent with what was already done in the pypi loader.
Additionally, I made the following changes:
- always check stats last (because a difference in numbers is hardly actionable without testing other objects)
- add a few more snapshot id checks in visits
- deduplicated a hardcoded snapshot id.
Migrated from D6607 (view on Phabricator)