coinbase / coinbase-python

DEPRECATED — Coinbase Python API
Apache License 2.0
528 stars 217 forks source link

Retrieve resource_path from response and apply to APIObject #85

Closed JohnLZeller closed 5 years ago

JohnLZeller commented 5 years ago

This offers a possible resolution to the issue described in #83.

I fixed a unit test that this change broke, but in the process I realized that many of the unit tests in this library seem to be broken. The other pieces that are still broken should not be related to my changes because they happen in master as well, mostly just ImportError: cannot import name DependencyWarning. I will try to find some time to take a closer look at those later. Let me know what I can do if this is not up to snuff @sds :)

sds commented 5 years ago

Since I merged your other PEP8 change (thanks for that), can you rebase?

Also, can you clarify why you think the tests are broken? They all pass for me.

⨠ nosetests
...............................................................................................................................
----------------------------------------------------------------------
Ran 127 tests in 2.242s
JohnLZeller commented 5 years ago

@sds rebased.

Hmm, I would trust your setup over mine in that case. I've used virtualenv with python 2.7 and then ran pip install on requirements.txt and test-requirements.txt, and I then see errors for RequestsDependencyWarning:

(venv) zeller@Johns-MacBook-Pro-5:~/dev/3p/coinbase-python (zeller/issue-83-fix)$ make tests
nosetests tests
/Users/zeller/venv/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.7.1) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
/Users/zeller/venv/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.7.1) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
/Users/zeller/venv/lib/python2.7/site-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.7.1) or chardet (3.0.4) doesn't match a supported version!
  RequestsDependencyWarning)
EEE.
======================================================================
ERROR: Failure: ImportError (cannot import name DependencyWarning)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/zeller/dev/3p/coinbase-python/tests/test_api_object.py", line 9, in <module>
    from requests.models import Response
  File "/Users/zeller/venv/lib/python2.7/site-packages/requests/__init__.py", line 105, in <module>
    from urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning

======================================================================
ERROR: Failure: ImportError (cannot import name DependencyWarning)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/zeller/dev/3p/coinbase-python/tests/test_client.py", line 19, in <module>
    from coinbase.wallet.client import Client
  File "/Users/zeller/dev/3p/coinbase-python/coinbase/wallet/client.py", line 10, in <module>
    import requests
  File "/Users/zeller/venv/lib/python2.7/site-packages/requests/__init__.py", line 105, in <module>
    from urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning

======================================================================
ERROR: Failure: ImportError (cannot import name DependencyWarning)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/Users/zeller/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/Users/zeller/dev/3p/coinbase-python/tests/test_model.py", line 13, in <module>
    from coinbase.wallet.client import Client
  File "/Users/zeller/dev/3p/coinbase-python/coinbase/wallet/client.py", line 10, in <module>
    import requests
  File "/Users/zeller/venv/lib/python2.7/site-packages/requests/__init__.py", line 105, in <module>
    from urllib3.exceptions import DependencyWarning
ImportError: cannot import name DependencyWarning

----------------------------------------------------------------------
Ran 4 tests in 0.002s

FAILED (errors=3)
make: *** [tests] Error 1
sds commented 5 years ago

There may be something in my environment deceiving me, but I'm doing the same as you.

If you had the spare cycles, getting a build running in Travis/CircleCI would help us narrow down?