changeset 40378:b015f30a91fb

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
author Augie Fackler <augie@google.com>
date Fri, 19 Oct 2018 11:45:25 -0400
parents 18da306e92b5
children 41506e3b04ee
files hgext/phabricator.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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)