Fixed #23418 -- Fail when migration deconstruct produces invalid import

prefer assertRaisesMessage to verify the ValueError is the one we want (also helps locate the code that's being tested).