Repository: Azure/pykusto (language: python)

Issue:
Support Python 3.9

Test all supported python versions
~~Merge only after #150~~

The build looks as if it fails on this branch, but that's only because we need to change the [branch protection policy](https://github.com/Azure/pykusto/settings/branches) with the updated builds.
We will do that right before we merge.


Discussion / hints:

Fix patch:
diff --git a/setup.py b/setup.py
index cbedb0aa..17b9902d 100644
--- a/setup.py
+++ b/setup.py
@@ -56,5 +56,7 @@
         "Programming Language :: Python :: 3.6",
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
+        "Programming Language :: Python :: 3.9",
+        "License :: OSI Approved :: MIT License",
     ],
 )


Test patch:
diff --git a/.github/workflows/runtests.yml b/.github/workflows/runtests.yml
index 89f8dea2..2f1755d4 100644
--- a/.github/workflows/runtests.yml
+++ b/.github/workflows/runtests.yml
@@ -15,7 +15,7 @@ jobs:
     runs-on: ubuntu-latest
     strategy:
       matrix:
-        python-version: [ '3.6', '3.7', '3.8' ]  # Make sure this matches the supported versions in setup.py
+        python-version: [ '3.6', '3.7', '3.8', '3.9' ]  # Make sure this matches the supported versions in setup.py
     steps:
     - uses: actions/checkout@v2
     - name: Set up Python ${{ matrix.python-version }}
diff --git a/test/test_base.py b/test/test_base.py
index a46e84bd..31e6fc05 100644
--- a/test/test_base.py
+++ b/test/test_base.py
@@ -5,8 +5,12 @@
 from threading import Event
 from typing import Callable, Tuple, Any, List, Optional, Union
 from unittest import TestCase
-# noinspection PyProtectedMember
-from unittest.case import _AssertLogsContext
+if sys.version_info[1] < 9:
+    # noinspection PyProtectedMember
+    from unittest.case import _AssertLogsContext
+else:
+    # noinspection PyUnresolvedReferences,PyProtectedMember,PyCompatibility
+    from unittest._log import _AssertLogsContext
 from urllib.parse import urljoin
 
 from azure.kusto.data import KustoClient, ClientRequestProperties
@@ -66,7 +70,7 @@ def assertLogs(self, logger_to_watch=None, level=None) -> 'CustomAssertLogsConte
         """
         This method overrides the one in `unittest.case.TestCase`, and has the same behavior, except for not causing a failure when there are no log messages.
         The point is to allow asserting there are no logs.
-        Get rid of this once this is resolved: https://github.com/python/cpython/pull/18067
+        Get rid of this in Python 3.10, as this was resolved: https://bugs.python.org/issue39385
         """
         # noinspection PyArgumentList
         return CustomAssertLogsContext(self, logger_to_watch, level)
@@ -76,6 +80,7 @@ def raise_mock_exception():
         raise Exception("Mock exception")
 
 
+# Get rid of this in Python 3.10, as this was resolved: https://bugs.python.org/issue39385
 class CustomAssertLogsContext(_AssertLogsContext):
     # noinspection PyUnresolvedReferences
     def __exit__(self, exc_type, exc_val, exc_tb) -> Optional[bool]: