phabricator: do more of the VCR work in demandimport.deactivated()
authorAugie Fackler <augie@google.com>
Fri, 19 Oct 2018 11:45:25 -0400
changeset 40378 b015f30a91fb
parent 40377 18da306e92b5
child 40379 41506e3b04ee
phabricator: do more of the VCR work in demandimport.deactivated() If I don't do this, VCR gets confused looking for pycurl and other libraries. I have no idea how this ever worked. Differential Revision: https://phab.mercurial-scm.org/D5159
hgext/phabricator.py
--- a/hgext/phabricator.py	Fri Oct 19 11:28:29 2018 -0400
+++ b/hgext/phabricator.py	Fri Oct 19 11:45:25 2018 -0400
@@ -131,14 +131,15 @@
                 with hgdemandimport.deactivated():
                     import vcr as vcrmod
                     import vcr.stubs as stubs
-                vcr = vcrmod.VCR(
-                    serializer=r'json',
-                    custom_patches=[
-                        (urlmod, 'httpconnection', stubs.VCRHTTPConnection),
-                        (urlmod, 'httpsconnection', stubs.VCRHTTPSConnection),
-                    ])
-                with vcr.use_cassette(cassette):
-                    return fn(*args, **kwargs)
+                    vcr = vcrmod.VCR(
+                        serializer=r'json',
+                        custom_patches=[
+                            (urlmod, 'httpconnection', stubs.VCRHTTPConnection),
+                            (urlmod, 'httpsconnection',
+                             stubs.VCRHTTPSConnection),
+                        ])
+                    with vcr.use_cassette(cassette):
+                        return fn(*args, **kwargs)
             return fn(*args, **kwargs)
         inner.__name__ = fn.__name__
         return command(name, fullflags, spec)(inner)