Skip to content

Commit

Permalink
support Python 3.8 in tests (#759)
Browse files Browse the repository at this point in the history
I upgraded my local Python version to 3.8 and some of the tests were failing. Removing the future wrapping fixes the issue.
  • Loading branch information
chdsbd authored Nov 23, 2021
1 parent 551ee05 commit 0c6cda5
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions bot/kodiak/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import asyncio
import sys
from typing import TypeVar

T = TypeVar("T")

# some change happened in Python 3.8 to eliminate the need for wrapping mock
# results.
if sys.version_info < (3, 8):

def wrap_future(x: T) -> "asyncio.Future[T]":
fut: "asyncio.Future[T]" = asyncio.Future()
fut.set_result(x)
return fut
def wrap_future(x: T) -> "asyncio.Future[T]":
fut: "asyncio.Future[T]" = asyncio.Future()
fut.set_result(x)
return fut


else:

def wrap_future(x: T) -> "T":
return x

0 comments on commit 0c6cda5

Please sign in to comment.