vcrpy: fails when working through proxy (as instructed by http_proxy env var): invalid literal for int() with base 10: '3128http'

as of 1.6.1 (as in Debian)

$> echo $http_proxy
http://localhost:3128

$> venv-tests/bin/nosetests -s -v datalad/crawler/nodes/tests/test_misc.py
datalad.crawler.nodes.tests.test_misc.test_get_deposition_filename ... ok
datalad.crawler.nodes.tests.test_misc.test_assign ... SKIP: TODO
datalad.crawler.nodes.tests.test_misc.test_rename ... SKIP: TODO

----------------------------------------------------------------------
Ran 3 tests in 14.059s

OK (SKIP=2)

$> venv-tests/bin/nosetests -s -v datalad/crawler/nodes/tests/test_misc.py
datalad.crawler.nodes.tests.test_misc.test_get_deposition_filename ... ERROR
datalad.crawler.nodes.tests.test_misc.test_assign ... SKIP: TODO
datalad.crawler.nodes.tests.test_misc.test_rename ... SKIP: TODO

======================================================================
ERROR: datalad.crawler.nodes.tests.test_misc.test_get_deposition_filename
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/yoh/proj/datalad/datalad/venv-tests/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/usr/lib/python2.7/dist-packages/vcr/cassette.py", line 95, in __call__
    return function(*args, **kwargs)
  File "/home/yoh/proj/datalad/datalad/datalad/crawler/nodes/tests/test_misc.py", line 22, in test_get_deposition_filename
    output = list(get_deposition_filename(**input))
  File "/home/yoh/proj/datalad/datalad/datalad/crawler/nodes/misc.py", line 85, in get_deposition_filename
    yield updated(data, {'filename': get_url_deposition_filename(data['url'])})
  File "/home/yoh/proj/datalad/datalad/datalad/support/network.py", line 46, in get_url_deposition_filename
    r = retry_urlopen(request)
  File "/home/yoh/proj/datalad/datalad/datalad/support/network.py", line 113, in retry_urlopen
    return urlopen(url)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1227, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1200, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/dist-packages/vcr/stubs/__init__.py", line 220, in getresponse
    if self.cassette.can_play_response_for(self._vcr_request):
  File "/usr/lib/python2.7/dist-packages/vcr/cassette.py", line 199, in can_play_response_for
    return request and request in self and \
  File "/usr/lib/python2.7/dist-packages/vcr/cassette.py", line 270, in __contains__
    for index, response in self._responses(request):
  File "/usr/lib/python2.7/dist-packages/vcr/cassette.py", line 194, in _responses
    if requests_match(request, stored_request, self._match_on):
  File "/usr/lib/python2.7/dist-packages/vcr/matchers.py", line 89, in requests_match
    matches = [(m(r1, r2), m) for m in matchers]
  File "/usr/lib/python2.7/dist-packages/vcr/matchers.py", line 25, in port
    return r1.port == r2.port
  File "/usr/lib/python2.7/dist-packages/vcr/request.py", line 67, in port
    port = parse_uri.port
  File "/usr/lib/python2.7/urlparse.py", line 113, in port
    port = int(port, 10)
ValueError: invalid literal for int() with base 10: '3128http'
(Pdb) up
> /usr/lib/python2.7/dist-packages/vcr/request.py(67)port()
-> port = parse_uri.port
(Pdb) up
> /usr/lib/python2.7/dist-packages/vcr/matchers.py(25)port()
-> return r1.port == r2.port
(Pdb) up
> /usr/lib/python2.7/dist-packages/vcr/matchers.py(89)requests_match()
-> matches = [(m(r1, r2), m) for m in matchers]
(Pdb) p r2
<Request (GET) http://localhost:3128http://human.brain-map.org/api/v2/well_known_file_download/157722290>

About this issue

  • Original URL
  • State: open
  • Created 9 years ago
  • Comments: 31 (15 by maintainers)

Most upvoted comments

Ehhh not to excited about adding some kind of pysocks dependency to run tests

Why is that? IMHO dependencies for devel/tests are totally fine. I only worry about adding deps when it affects install. In particular, I’d rather add dev deps to keep things self-contained than depend on an external server.