diff --git a/auth0/test_async/test_async_auth0.py b/auth0/test_async/test_async_auth0.py index 753666b5..0089f99d 100644 --- a/auth0/test_async/test_async_auth0.py +++ b/auth0/test_async/test_async_auth0.py @@ -22,7 +22,11 @@ def callback(url, **kwargs): return callback, mock -class TestAuth0(unittest.IsolatedAsyncioTestCase): +@unittest.skipIf( + not hasattr(unittest, "IsolatedAsyncioTestCase"), + "python 3.7 doesn't have IsolatedAsyncioTestCase", +) +class TestAuth0(getattr(unittest, "IsolatedAsyncioTestCase", object)): @pytest.mark.asyncio @aioresponses() async def test_get(self, mocked): diff --git a/auth0/test_async/test_async_token_verifier.py b/auth0/test_async/test_async_token_verifier.py index 7559c693..f1494c8e 100644 --- a/auth0/test_async/test_async_token_verifier.py +++ b/auth0/test_async/test_async_token_verifier.py @@ -55,7 +55,13 @@ def get_pem_bytes(rsa_public_key): ) -class TestAsyncAsymmetricSignatureVerifier(unittest.IsolatedAsyncioTestCase): +@unittest.skipIf( + not hasattr(unittest, "IsolatedAsyncioTestCase"), + "python 3.7 doesn't have IsolatedAsyncioTestCase", +) +class TestAsyncAsymmetricSignatureVerifier( + getattr(unittest, "IsolatedAsyncioTestCase", object) +): @pytest.mark.asyncio @aioresponses() async def test_async_asymmetric_verifier_fetches_key(self, mocked): @@ -69,7 +75,11 @@ async def test_async_asymmetric_verifier_fetches_key(self, mocked): self.assertEqual(get_pem_bytes(key), RSA_PUB_KEY_1_PEM) -class TestAsyncJwksFetcher(unittest.IsolatedAsyncioTestCase): +@unittest.skipIf( + not hasattr(unittest, "IsolatedAsyncioTestCase"), + "python 3.7 doesn't have IsolatedAsyncioTestCase", +) +class TestAsyncJwksFetcher(getattr(unittest, "IsolatedAsyncioTestCase", object)): @pytest.mark.asyncio @aioresponses() @unittest.mock.patch( @@ -225,7 +235,11 @@ async def test_async_fails_to_fetch_jwks_json_after_retrying_twice(self, mocked) self.assertEqual(mock.call_count, 2) -class TestAsyncTokenVerifier(unittest.IsolatedAsyncioTestCase): +@unittest.skipIf( + not hasattr(unittest, "IsolatedAsyncioTestCase"), + "python 3.7 doesn't have IsolatedAsyncioTestCase", +) +class TestAsyncTokenVerifier(getattr(unittest, "IsolatedAsyncioTestCase", object)): @pytest.mark.asyncio @aioresponses() async def test_RS256_token_signature_passes(self, mocked): diff --git a/auth0/test_async/test_asyncify.py b/auth0/test_async/test_asyncify.py index acc3f54d..6c0175d0 100644 --- a/auth0/test_async/test_asyncify.py +++ b/auth0/test_async/test_asyncify.py @@ -54,7 +54,11 @@ def callback(url, **kwargs): return callback, mock -class TestAsyncify(unittest.IsolatedAsyncioTestCase): +@unittest.skipIf( + not hasattr(unittest, "IsolatedAsyncioTestCase"), + "python 3.7 doesn't have IsolatedAsyncioTestCase", +) +class TestAsyncify(getattr(unittest, "IsolatedAsyncioTestCase", object)): @pytest.mark.asyncio @aioresponses() async def test_get(self, mocked):