Repository: edgedb/edgedb-python (language: python)

Issue:
add windows to github CI
Run test on windows as well as linux and macos.


Discussion / hints:
@fmoor, please rebase.

Fix patch:
diff --git a/edgedb/_cluster.py b/edgedb/_cluster.py
deleted file mode 100644
index 0dc57513..00000000
--- a/edgedb/_cluster.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#
-# This source file is part of the EdgeDB open source project.
-#
-# Copyright 2016-present MagicStack Inc. and the EdgeDB authors.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-
-import errno
-import random
-import socket
-
-
-def find_available_port(port_range=(49152, 65535), max_tries=1000):
-    low, high = port_range
-
-    port = low
-    try_no = 0
-
-    while try_no < max_tries:
-        try_no += 1
-        port = random.randint(low, high)
-        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-        try:
-            sock.bind(('localhost', port))
-        except socket.error as e:
-            if e.errno == errno.EADDRINUSE:
-                continue
-        finally:
-            sock.close()
-
-        break
-    else:
-        port = None
-
-    return port


Test patch:
diff --git a/tests/test_connect.py b/tests/test_connect.py
index ccd39753..ce3f6405 100644
--- a/tests/test_connect.py
+++ b/tests/test_connect.py
@@ -17,9 +17,10 @@
 #
 
 
+import socket
+
 import edgedb
 
-from edgedb import _cluster
 from edgedb import _testbase as tb
 
 
@@ -28,7 +29,18 @@ class TestConnect(tb.AsyncQueryTestCase):
     @classmethod
     def setUpClass(cls):
         super().setUpClass()
-        cls.port = _cluster.find_available_port()
+        cls.port = cls._get_free_port()
+
+    @classmethod
+    def _get_free_port(cls):
+        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        try:
+            sock.bind(('127.0.0.1', 0))
+            return sock.getsockname()[1]
+        except Exception:
+            return None
+        finally:
+            sock.close()
 
     async def test_connect_async_01(self):
         orig_conn_args = self.get_connect_args()