Skip to content

Commit 5fe7d00

Browse files
sid-rlstainless-app[bot]
authored andcommitted
chore(smoketests): fixed smoketests and cleaned up typing/formatting (#699)
* increase timeout for flaky smoketest * don't convert params from TypedDict to dict (unnecessary and undoes type hints) * docstring formatting fixes * removed shell exec tests with 'working_dir' parameter testing
1 parent 663ead3 commit 5fe7d00

7 files changed

Lines changed: 5 additions & 66 deletions

File tree

src/runloop_api_client/sdk/async_.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,17 +222,16 @@ class AsyncBlueprintOps:
222222
... dockerfile="FROM ubuntu:22.04\\nRUN apt-get update",
223223
... )
224224
>>> blueprints = await runloop.blueprint.list()
225-
225+
226226
To use a local directory as a build context, use an object.
227227
228228
Example:
229229
>>> from datetime import timedelta
230230
>>> from runloop_api_client.types.blueprint_build_parameters import BuildContext
231-
>>>
232231
>>> runloop = AsyncRunloopSDK()
233232
>>> obj = await runloop.object_storage.upload_from_dir(
234233
... "./",
235-
... ttl=timedelta(hours=1),
234+
... ttl=timedelta(hours=1),
236235
... )
237236
>>> blueprint = await runloop.blueprint.create(
238237
... name="my-blueprint",

src/runloop_api_client/sdk/async_devbox.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,6 @@ async def exec(
643643
>>> result = await shell.exec("npm install", stdout=lambda line: print(f"[LOG] {line}"))
644644
"""
645645
# Ensure shell_name is set and cannot be overridden by user params
646-
params = dict(params)
647646
params["shell_name"] = self._shell_name
648647
return await self._devbox.cmd.exec(command, **params)
649648

@@ -677,7 +676,6 @@ async def exec_async(
677676
... print("Task completed successfully!")
678677
"""
679678
# Ensure shell_name is set and cannot be overridden by user params
680-
params = dict(params)
681679
params["shell_name"] = self._shell_name
682680
return await self._devbox.cmd.exec_async(command, **params)
683681

src/runloop_api_client/sdk/devbox.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ def exec(
651651
>>> result = shell.exec("npm install", stdout=lambda line: print(f"[LOG] {line}"))
652652
"""
653653
# Ensure shell_name is set and cannot be overridden by user params
654-
params = dict(params)
655654
params["shell_name"] = self._shell_name
656655
return self._devbox.cmd.exec(command, **params)
657656

@@ -685,7 +684,6 @@ def exec_async(
685684
... print("Task completed successfully!")
686685
"""
687686
# Ensure shell_name is set and cannot be overridden by user params
688-
params = dict(params)
689687
params["shell_name"] = self._shell_name
690688
return self._devbox.cmd.exec_async(command, **params)
691689

src/runloop_api_client/sdk/sync.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,10 @@ class BlueprintOps:
227227
Example:
228228
>>> from datetime import timedelta
229229
>>> from runloop_api_client.types.blueprint_build_parameters import BuildContext
230-
>>>
231230
>>> runloop = RunloopSDK()
232231
>>> obj = runloop.object_storage.upload_from_dir(
233232
... "./",
234-
... ttl=timedelta(hours=1),
233+
... ttl=timedelta(hours=1),
235234
... )
236235
>>> blueprint = runloop.blueprint.create(
237236
... name="my-blueprint",

tests/smoketests/sdk/test_async_devbox.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -930,34 +930,6 @@ async def test_shell_auto_generated_name(self, devbox: AsyncDevbox) -> None:
930930
output = await result.stdout()
931931
assert "test" in output
932932

933-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
934-
async def test_shell_exec_with_additional_params(self, devbox: AsyncDevbox) -> None:
935-
"""Test that additional params are passed through correctly."""
936-
shell = devbox.shell("test-shell-params")
937-
938-
# Test that additional params (like working_dir) are passed through correctly
939-
# Note: shell_name should override any shell_name in params
940-
result = await shell.exec("pwd", working_dir="/tmp")
941-
942-
assert result.exit_code == 0
943-
output = (await result.stdout()).strip()
944-
# Should be in /tmp due to working_dir param
945-
assert output == "/tmp"
946-
947-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
948-
async def test_shell_exec_async_with_additional_params(self, devbox: AsyncDevbox) -> None:
949-
"""Test that additional params are passed through correctly in exec_async."""
950-
shell = devbox.shell("test-shell-async-params")
951-
952-
# Test that additional params are passed through correctly
953-
execution = await shell.exec_async("pwd", working_dir="/home")
954-
955-
result = await execution.result()
956-
assert result.exit_code == 0
957-
output = (await result.stdout()).strip()
958-
# Should be in /home due to working_dir param
959-
assert output == "/home"
960-
961933
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
962934
async def test_shell_exec_with_stderr_streaming(self, devbox: AsyncDevbox) -> None:
963935
"""Test shell exec with stderr streaming callback."""

tests/smoketests/sdk/test_async_storage_object.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
THIRTY_SECOND_TIMEOUT = 30
1616
TWO_MINUTE_TIMEOUT = 120
17+
FOUR_MINUTE_TIMEOUT = 240
1718

1819

1920
class TestAsyncStorageObjectLifecycle:
@@ -464,7 +465,7 @@ async def test_complete_upload_download_workflow(self, async_sdk_client: AsyncRu
464465
# Delete
465466
await obj.delete()
466467

467-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
468+
@pytest.mark.timeout(FOUR_MINUTE_TIMEOUT)
468469
async def test_storage_object_in_devbox_workflow(self, async_sdk_client: AsyncRunloopSDK) -> None:
469470
"""Test workflow: create storage object, write from devbox, download."""
470471
# Create empty storage object

tests/smoketests/sdk/test_devbox.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -918,34 +918,6 @@ def test_shell_auto_generated_name(self, devbox: Devbox) -> None:
918918
output = result.stdout()
919919
assert "test" in output
920920

921-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
922-
def test_shell_exec_with_additional_params(self, devbox: Devbox) -> None:
923-
"""Test that additional params are passed through correctly."""
924-
shell = devbox.shell("test-shell-params")
925-
926-
# Test that additional params (like working_dir) are passed through correctly
927-
# Note: shell_name should override any shell_name in params
928-
result = shell.exec("pwd", working_dir="/tmp")
929-
930-
assert result.exit_code == 0
931-
output = result.stdout().strip()
932-
# Should be in /tmp due to working_dir param
933-
assert output == "/tmp"
934-
935-
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
936-
def test_shell_exec_async_with_additional_params(self, devbox: Devbox) -> None:
937-
"""Test that additional params are passed through correctly in exec_async."""
938-
shell = devbox.shell("test-shell-async-params")
939-
940-
# Test that additional params are passed through correctly
941-
execution = shell.exec_async("pwd", working_dir="/home")
942-
943-
result = execution.result()
944-
assert result.exit_code == 0
945-
output = result.stdout().strip()
946-
# Should be in /home due to working_dir param
947-
assert output == "/home"
948-
949921
@pytest.mark.timeout(TWO_MINUTE_TIMEOUT)
950922
def test_shell_exec_with_stderr_streaming(self, devbox: Devbox) -> None:
951923
"""Test shell exec with stderr streaming callback."""

0 commit comments

Comments
 (0)