py3: use fsencode for vcr recording paths and strings for custom_patches args
authorIan Moody <moz-ian@perix.co.uk>
Fri, 08 Mar 2019 17:57:59 +0000
changeset 41898 2bad8f92cebf
parent 41897 c340a8ac7ef3
child 41899 9a8c7c17d816
py3: use fsencode for vcr recording paths and strings for custom_patches args This fixes phabricator.py's vcrcommand under py3 Differential Revision: https://phab.mercurial-scm.org/D6102
hgext/phabricator.py
--- a/hgext/phabricator.py	Sat Mar 02 18:48:23 2019 +0000
+++ b/hgext/phabricator.py	Fri Mar 08 17:57:59 2019 +0000
@@ -128,7 +128,7 @@
     fullflags = flags + _VCR_FLAGS
     def decorate(fn):
         def inner(*args, **kwargs):
-            cassette = kwargs.pop(r'test_vcr', None)
+            cassette = pycompat.fsdecode(kwargs.pop(r'test_vcr', None))
             if cassette:
                 import hgdemandimport
                 with hgdemandimport.deactivated():
@@ -137,8 +137,9 @@
                     vcr = vcrmod.VCR(
                         serializer=r'json',
                         custom_patches=[
-                            (urlmod, 'httpconnection', stubs.VCRHTTPConnection),
-                            (urlmod, 'httpsconnection',
+                            (urlmod, r'httpconnection',
+                             stubs.VCRHTTPConnection),
+                            (urlmod, r'httpsconnection',
                              stubs.VCRHTTPSConnection),
                         ])
                     with vcr.use_cassette(cassette):