Skip to content

Commit

Permalink
Skip asyncio tests for sync functions
Browse files Browse the repository at this point in the history
  • Loading branch information
goodoldneon committed Jun 14, 2024
1 parent e5319dd commit 043eb14
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 31 deletions.
14 changes: 9 additions & 5 deletions tests/test_function/cases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from inngest._internal import const

from . import (
asyncio_first_completed,
asyncio_gather,
asyncio_race,
base,
batch_that_needs_api,
cancel,
Expand Down Expand Up @@ -46,7 +46,7 @@

_modules = (
asyncio_gather,
asyncio_race,
asyncio_first_completed,
batch_that_needs_api,
cancel,
change_step_error,
Expand Down Expand Up @@ -100,9 +100,13 @@ def create_sync_cases(
client: inngest.Inngest,
framework: const.Framework,
) -> list[base.Case]:
return [
module.create(client, framework, is_sync=True) for module in _modules
]
cases = []
for module in _modules:
case = module.create(client, framework, is_sync=True)
if isinstance(case.fn, list) and len(case.fn) > 1:
cases.append(case)

return cases


__all__ = ["create_async_cases", "create_sync_cases"]
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,6 @@ def create(
fn_id = base.create_fn_id(test_name)
state = _State()

@client.create_function(
fn_id=fn_id,
retries=0,
trigger=inngest.TriggerEvent(event=event_name),
)
def fn_sync(
ctx: inngest.Context,
step: inngest.StepSync,
) -> None:
# This test is not applicable for sync functions
pass

@client.create_function(
fn_id=f"{fn_id}/child",
retries=0,
Expand Down Expand Up @@ -135,7 +123,8 @@ async def run_test(self: base.TestClass) -> None:
assert state.done_result == "fast"

if is_sync:
fn = [fn_sync]
# This test is not applicable for sync functions
fn = []
else:
fn = [fn_async, fn_child_async]

Expand Down
15 changes: 2 additions & 13 deletions tests/test_function/cases/asyncio_gather.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,6 @@ def create(
fn_id = base.create_fn_id(test_name)
state = _State()

@client.create_function(
fn_id=fn_id,
retries=0,
trigger=inngest.TriggerEvent(event=event_name),
)
def fn_sync(
ctx: inngest.Context,
step: inngest.StepSync,
) -> None:
# This test is not applicable for sync functions
pass

@client.create_function(
fn_id=f"{fn_id}/child",
retries=0,
Expand Down Expand Up @@ -116,7 +104,8 @@ async def run_test(self: base.TestClass) -> None:
assert state.output == [None, "slow", "fast", None, None, None]

if is_sync:
fn = [fn_sync]
# This test is not applicable for sync functions
fn = []
else:
fn = [fn_async, fn_child_async]

Expand Down

0 comments on commit 043eb14

Please sign in to comment.