Clean up how PatchPolicies works
Clean up how PatchPolicies works

We've got these lovely __enter__ and __exit__ methods; let's use them!

Note that this also changes how we patch classes' setUp methods so we
don't set self._orig_POLICIES when the class is already patched.  I
hope this may fix some sporadic failures that include tracebacks
that look like

  proxy ERROR: ERROR 500 Traceback (most recent call last):
    File ".../swift/obj/server.py", line 1105, in __call__
      res = getattr(self, req.method)(req)
    File ".../swift/common/utils.py", line 1626, in _timing_stats
      resp = func(ctrl, *args, **kwargs)
    File ".../swift/obj/server.py", line 880, in GET
      policy=policy, frag_prefs=frag_prefs)
    File ".../swift/obj/server.py", line 211, in get_diskfile
      return self._diskfile_router[policy].get_diskfile(
    File ".../swift/obj/diskfile.py", line 555, in __getitem__
      return self.policy_to_manager[policy]
  KeyError: ECStoragePolicy(...)

... and try to unpatch more gracefully with TestCase.addCleanup

Change-Id: Iaa3d42ec21758b0707155878a645e665aa36696c

matthewoliver/swift,openstack/swift,matthewoliver/swift,notmyname/swift,psachin/swift,psachin/swift,clayg/swift,smerritt/swift,nadeemsyed/swift,tipabu/swift,matthewoliver/swift,notmyname/swift,redbo/swift,clayg/swift,clayg/swift,psachin/swift,openstack/swift,smerritt/swift,nadeemsyed/swift,tipabu/swift,swiftstack/swift,openstack/swift,smerritt/swift,notmyname/swift,swiftstack/swift,tipabu/swift,swiftstack/swift,openstack/swift,redbo/swift,smerritt/swift,clayg/swift,matthewoliver/swift,notmyname/swift,tipabu/swift,nadeemsyed/swift,nadeemsyed/swift,psachin/swift