This is an automated email from the ASF dual-hosted git repository.

tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ea0bf7c3c Make sure we use a different port for each test run to avoid 
issues when running multiple tests in parallel.
ea0bf7c3c is described below

commit ea0bf7c3cb740f26eb107df80a13c374065b30e2
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Fri Dec 9 00:05:16 2022 +0100

    Make sure we use a different port for each test run to avoid issues when
    running multiple tests in parallel.
---
 libcloud/test/common/test_google.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libcloud/test/common/test_google.py 
b/libcloud/test/common/test_google.py
index b223af985..0b4250c61 100644
--- a/libcloud/test/common/test_google.py
+++ b/libcloud/test/common/test_google.py
@@ -18,6 +18,7 @@ Tests for Google Connection classes.
 import os
 import sys
 import time
+import random
 import urllib
 import datetime
 import unittest
@@ -283,6 +284,9 @@ class 
GoogleInstalledAppAuthConnectionFirstLoginTest(LibcloudTestCase):
         self.mock_scopes = ["https://www.googleapis.com/auth/foo";]
         kwargs = {"scopes": self.mock_scopes}
         self.conn = GoogleInstalledAppAuthConnection(*GCE_PARAMS, **kwargs)
+        # We select random port on which HTTP server binds to, to avoid race 
conditions when
+        # running multiple tests in parallel
+        self.conn.redirect_uri_port = random.randint(5000, 20000)
 
     def test_it_receives_the_code_that_google_sends_via_local_loopback(self):
         expected_code = "1234ABC"

Reply via email to