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
--- 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):