Add test for dependency solving

Opening a dependency's package file was extracted in a separate helper
function to allow mocking it in testing. Tests exploiting this
possibility were also added.