Integration tests - flake8 fixes to core files

In line with some other work the Python integration tests also needs to pass `flake8`. To limit the potential for conflicts this should be done on a file-by-file basis. This first PR fixes the two core helper files as they are used by almost all other test files.

To test the two relevant files should pass `flake8` and the integration tests should pass (barring usual intermittent failures).