CLI unit tests (flake8 and Travis fix)

This PR fixes the CLI unit tests (in preparation of https://trac.openmicroscopy.org.uk/ome/ticket/11201) by
- fixing the `flake8` output for all the tests under `test/unit/clitest`
- refactoring `test_prefs.py` to use the pytest `capsys` fixture directly (see #1792)
- adding a commit which fixes `pytest` installation in the Travis environment so that the unit tests can be run as