Changed list of context managers in with statements into nested with
  statements so that tests pass on 2.6.