Fixed a bug where when mirror_local_mode lcd was not obeyed. Added tests.
Changed list of context managers in with statements into nested with
  statements so that tests pass on 2.6.
Refactored test code a bit
Changelog, closes #1146
Merge branch '1.7' into 1.8
Merge branch '1.8' into 1.9