Skip to content

Commit

Permalink
make test script compatible with python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
mdavis-xyz committed Nov 13, 2024
1 parent c20f949 commit 5f5b4d9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lambda_multiprocessing/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@
from typing import Tuple, Optional
from pathlib import Path
import os
from functools import cache
import sys


import boto3
from moto import mock_aws
from lambda_multiprocessing.timeout import TimeoutManager, TestTimeoutException

if sys.version_info < (3, 9):
# functools.cache was added in 3.9
# define an empty decorator that doesn't do anything
# (our usage of the cache isn't essential)
def cache(func):
return func
else:
# Import the cache function from functools for Python 3.9 and above
from functools import cache

# add an overhead for duration when asserting the duration of child processes
# if other processes are hogging CPU, make this bigger
delta = 0.1
Expand Down Expand Up @@ -39,7 +50,7 @@ def return_with_sleep(x, delay=0.3):

def _raise(ex: Optional[Exception]):
if ex:
raise exfrom .timeout
raise ex

class ExceptionA(Exception):
pass
Expand Down

0 comments on commit 5f5b4d9

Please sign in to comment.