Captricity / mocurly

Mocurly is a library that mocks the recurly python client
MIT License
8 stars 6 forks source link

python 3.7 error #20

Open caleb15 opened 4 years ago

caleb15 commented 4 years ago

mocurly depends on a old version of httpretty that doesn't support python 3.7

It requires httpretty <=0.8.10 but at least httpretty 0.9.5 is needed to be compatible with python 3.7 - see https://github.com/spulec/moto/issues/1706 and https://github.com/gabrielfalcao/HTTPretty/pull/339

Error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/local/lib/python3.7/unittest/case.py", line 628, in run
    testMethod()
  File "/home/circleci/project/ff/mods/billing/tests/test_recurly_integration.py", line 71, in test_cancel_all_subscriptions
    with mocurly():
  File "/home/circleci/project/venv/lib/python3.7/site-packages/mocurly/core.py", line 43, in __enter__
    self.start()
  File "/home/circleci/project/venv/lib/python3.7/site-packages/mocurly/core.py", line 64, in start
    self._register()
  File "/home/circleci/project/venv/lib/python3.7/site-packages/mocurly/core.py", line 165, in _register
    content_type="application/xml")
  File "/home/circleci/project/venv/lib/python3.7/site-packages/httpretty/core.py", line 940, in register_uri
    match_querystring)
  File "/home/circleci/project/venv/lib/python3.7/site-packages/httpretty/core.py", line 762, in __init__
    self.info = URIInfo.from_uri(uri, entries)
  File "/home/circleci/project/venv/lib/python3.7/site-packages/httpretty/core.py", line 732, in from_uri
    result = urlsplit(uri)
  File "/usr/local/lib/python3.7/urllib/parse.py", line 418, in urlsplit
    url, scheme, _coerce_result = _coerce_args(url, scheme)
  File "/usr/local/lib/python3.7/urllib/parse.py", line 123, in _coerce_args
    return _decode_args(args) + (_encode_result,)
  File "/usr/local/lib/python3.7/urllib/parse.py", line 107, in _decode_args
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
  File "/usr/local/lib/python3.7/urllib/parse.py", line 107, in <genexpr>
    return tuple(x.decode(encoding, errors) if x else '' for x in args)
AttributeError: 're.Pattern' object has no attribute 'decode'

We can submit a PR to fix this.

caleb15 commented 4 years ago

Specifying httpretty==0.9.5 solved the unit test failures for us