Page MenuHomePhabricator

tests.api_tests.TestCachedRequest failure (vcr = True)
Closed, InvalidPublic

Description

api_tests.TestCachedRequest.test_normal_use is failing for me, however it's passing on travis-ci. Here is the traceback:

Launching unittests with arguments python -m unittest api_tests.TestCachedRequest.test_normal_use in ...\pywikibot-core\tests

tests: max_retries reduced from 5 to 1ERROR: Traceback (most recent call last):
  File "...\pywikibot-core\pywikibot\data\api.py", line 1966, in submit
    body=body, headers=headers)
  File "...\pywikibot-core\pywikibot\tools\__init__.py", line 1446, in wrapper
    return obj(*__args, **__kw)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 317, in request
    r = fetch(baseuri, method, params, body, headers, **kwargs)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 519, in fetch
    error_handling_callback(request)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 405, in error_handling_callback
    raise request.data
  File "...\pywikibot-core\pywikibot\comms\http.py", line 384, in _http_process
    **http_request.kwargs)
  File "...\Python36\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "...\Python36\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "...\Python36\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "...\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "...\Python36\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse(buffering=True)
  File "...\Python36\lib\site-packages\vcr\stubs\__init__.py", line 232, in getresponse
    self.cassette.record_mode)
vcr.errors.CannotOverwriteExistingCassetteException: No match for the request (<Request (POST) https://en.wikipedia.org/w/api.php>) was found. Can't overwrite existing cassette ('...\\pywikibot-core\\tests\\cassettes\\wikipedia.en/TestCachedRequest.test_normal_use.yaml') in your current record mode ('once').

WARNING: Waiting 0 seconds before retrying.
ERROR: Traceback (most recent call last):
  File "...\pywikibot-core\pywikibot\data\api.py", line 1966, in submit
    body=body, headers=headers)
  File "...\pywikibot-core\pywikibot\tools\__init__.py", line 1446, in wrapper
    return obj(*__args, **__kw)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 317, in request
    r = fetch(baseuri, method, params, body, headers, **kwargs)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 519, in fetch
    error_handling_callback(request)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 405, in error_handling_callback
    raise request.data
  File "...\pywikibot-core\pywikibot\comms\http.py", line 384, in _http_process
    **http_request.kwargs)
  File "...\Python36\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "...\Python36\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "...\Python36\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "...\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "...\Python36\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse(buffering=True)
  File "...\Python36\lib\site-packages\vcr\stubs\__init__.py", line 232, in getresponse
    self.cassette.record_mode)
vcr.errors.CannotOverwriteExistingCassetteException: No match for the request (<Request (POST) https://en.wikipedia.org/w/api.php>) was found. Can't overwrite existing cassette ('...\\pywikibot-core\\tests\\cassettes\\wikipedia.en/TestCachedRequest.test_normal_use.yaml') in your current record mode ('once').


Error
Traceback (most recent call last):
  File "...\pywikibot-core\pywikibot\data\api.py", line 1966, in submit
    body=body, headers=headers)
  File "...\pywikibot-core\pywikibot\tools\__init__.py", line 1446, in wrapper
    return obj(*__args, **__kw)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 317, in request
    r = fetch(baseuri, method, params, body, headers, **kwargs)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 519, in fetch
    error_handling_callback(request)
  File "...\pywikibot-core\pywikibot\comms\http.py", line 405, in error_handling_callback
    raise request.data
  File "...\pywikibot-core\pywikibot\comms\http.py", line 384, in _http_process
    **http_request.kwargs)
  File "...\Python36\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "...\Python36\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "...\Python36\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "...\Python36\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "...\Python36\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
    httplib_response = conn.getresponse(buffering=True)
  File "...\Python36\lib\site-packages\vcr\stubs\__init__.py", line 232, in getresponse
    self.cassette.record_mode)
vcr.errors.CannotOverwriteExistingCassetteException: No match for the request (<Request (POST) https://en.wikipedia.org/w/api.php>) was found. Can't overwrite existing cassette ('...\\pywikibot-core\\tests\\cassettes\\wikipedia.en/TestCachedRequest.test_normal_use.yaml') in your current record mode ('once').

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "...\Python36\lib\unittest\case.py", line 59, in testPartExecutor
    yield
  File "...\Python36\lib\unittest\case.py", line 605, in run
    testMethod()
  File "...\pywikibot-core\tests\api_tests.py", line 885, in test_normal_use
    mainpage = self.get_mainpage()
  File "...\pywikibot-core\tests\aspects.py", line 1117, in get_mainpage
    if not isinstance(site, DrySite) and mainpage.isRedirectPage():
  File "...\pywikibot-core\pywikibot\page.py", line 812, in isRedirectPage
    return self.site.page_isredirect(self)
  File "...\pywikibot-core\pywikibot\site.py", line 3148, in page_isredirect
    self.loadpageinfo(page)
  File "...\pywikibot-core\pywikibot\site.py", line 2966, in loadpageinfo
    self._update_page(page, query)
  File "...\pywikibot-core\pywikibot\site.py", line 2949, in _update_page
    for pageitem in query:
  File "...\pywikibot-core\pywikibot\data\api.py", line 2835, in __iter__
    self.data = self.request.submit()
  File "...\pywikibot-core\pywikibot\data\api.py", line 1990, in submit
    self.wait()
  File "...\pywikibot-core\pywikibot\data\api.py", line 2222, in wait
    raise TimeoutError("Maximum retries attempted without success.")
pywikibot.exceptions.TimeoutError: Maximum retries attempted without success.



Ran 1 test in 0.295s

FAILED (errors=1)

Event Timeline

Dalba created this task.Jun 3 2018, 4:44 PM
Restricted Application added subscribers: pywikibot-bugs-list, Aklapper. · View Herald TranscriptJun 3 2018, 4:44 PM
Dalba renamed this task from tests.api_tests.TestCachedRequest is failure (vcr = True) to tests.api_tests.TestCachedRequest failure (vcr = True).Jun 3 2018, 4:44 PM
Xqt added a subscriber: Xqt.Jun 3 2018, 6:10 PM

Working for me:

C:\pwb\GIT\core>py -3 pwb.py api_tests -v TestCachedRequest.test_normal_use
tests: max_retries reduced from 15 to 1
test_normal_use (__main__.TestCachedRequest)
Test the caching of CachedRequest with an ordinary request. ... ok

----------------------------------------------------------------------
Ran 1 test in 1.389s

OK

C:\pwb\GIT\core>py -2 pwb.py api_tests -v TestCachedRequest.test_normal_use
tests: max_retries reduced from 15 to 1
test_normal_use (__main__.TestCachedRequest)
Test the caching of CachedRequest with an ordinary request. ... ok

----------------------------------------------------------------------
Ran 1 test in 3.166s

OK

C:\pwb\GIT\core>
Dalba closed this task as Invalid.Jun 4 2018, 12:37 PM

Can't reproduce it anymore.

Vvjjkkii renamed this task from tests.api_tests.TestCachedRequest failure (vcr = True) to 4pbaaaaaaa.Jul 1 2018, 1:06 AM
Vvjjkkii reopened this task as Open.
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot closed this task as Invalid.
CommunityTechBot renamed this task from 4pbaaaaaaa to tests.api_tests.TestCachedRequest failure (vcr = True).
CommunityTechBot added a subscriber: Aklapper.