I'd move L713-723 into a function in `pip.wheel`, and then use unit tests, vs the `pip install` functional tests