Skip to content

Commit

Permalink
Fix race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Wayne Parrott committed Mar 18, 2017
1 parent af9677a commit bebf653
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
8 changes: 7 additions & 1 deletion tests/oauth2/test_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ def test_run_local_server(

with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
future = pool.submit(instance.run_local_server)
requests.get(auth_redirect_url)

while not future.done():
try:
requests.get(auth_redirect_url)
except requests.ConnectionError: # pragma: NO COVER
pass

credentials = future.result()

assert credentials.token == mock.sentinel.access_token
Expand Down
7 changes: 4 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ envlist = lint,py27,py34,py35,py36,pypy,cover

[testenv]
deps =
certifi
flask
futures
mock
oauth2client
pytest
pytest-cov
pytest-localserver
urllib3
certifi
requests
requests-oauthlib
oauth2client
urllib3
grpcio; platform_python_implementation != 'PyPy'
commands =
py.test --cov=google.auth --cov=google.oauth2 --cov=tests {posargs:tests}
Expand Down

0 comments on commit bebf653

Please sign in to comment.