Fix test-requires string iteration

To avoid strings being extended and this causing the test
requirements to become invalid/corrupted we instead will do
a little refactoring on the replacement run script and use
the yield_lines method from pkg_resources (which is what the
other setuptools functions use as well) to correctly yield back
strings (or strings inside lists) in a correct manner that
should avoid the corruption problem.

Fixes bug 1355426

Change-Id: I1ccf63861cef704f494f391980430fa87347a64b
Merge "Fix test-requires string iteration"