RunOrVeith commented on PR #1807:
URL: https://github.com/apache/libcloud/pull/1807#issuecomment-1344099592

   Ok, I see the problem. I only ran the tests locally without any parallel 
execution so I didn't notice this. Thanks for the fixes!
   I think the proper fix for the second problem would be to use 
[Event](https://docs.python.org/3/library/threading.html#threading.Event), so 
basically (untested):
   
   ```python
           ...
           sign_in_started = threading.Event()
           received_code = None
   
           def _get_code():
               nonlocal received_code
               sign_in_started.set()
               received_code = self.conn.get_code()
   
           def _send_code():
               target_url = self.conn._redirect_uri_with_port
               params = {"state": state, "code": expected_code}
               params = urllib.parse.urlencode(params, 
quote_via=urllib.parse.quote)
               requests.get(url=target_url, params=params)
   
           fake_sign_in_thread = threading.Thread(target=_get_code)
           fake_google_response = threading.Thread(target=_send_code)
   
           fake_sign_in_thread.start()
           sign_in_started.wait()
           fake_google_response.start()
          ...
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to