Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
cstub committed Jan 14, 2025
1 parent 3b39b05 commit 7d21249
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@ jobs:
run: |
pip install dist/*.whl
pip install pytest pytest-asyncio
pytest smoke_test.py
pytest tests/test_basic.py
pip uninstall -y ipybox
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import tempfile

import pytest


@pytest.fixture(scope="module")
async def workspace():
with tempfile.TemporaryDirectory() as temp_dir:
yield temp_dir
11 changes: 1 addition & 10 deletions smoke_test.py → tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
import tempfile

import pytest

from ipybox import ExecutionClient, ExecutionContainer


@pytest.fixture(scope="module")
async def workspace():
with tempfile.TemporaryDirectory() as temp_dir:
yield temp_dir


@pytest.fixture(scope="module")
async def executor(workspace: str):
async with ExecutionContainer(
tag="ghcr.io/gradion-ai/ipybox:minimal",
binds={workspace: "workspace"},
env={"TEST_VAR": "test_val"},
) as container:
async with ExecutionClient(host="localhost", port=container.port) as client:
yield client


@pytest.mark.asyncio(loop_scope="module")
async def test_single_command_output(executor):
async def test_basic_functionality(executor):
result = await executor.execute("print('Hello, world!')")
assert result.text == "Hello, world!"
7 changes: 0 additions & 7 deletions tests/ipybox_test.py → tests/test_ipybox.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import asyncio
import re
import subprocess
import tempfile
from pathlib import Path
from typing import Generator

Expand All @@ -12,12 +11,6 @@
from ipybox import DEFAULT_TAG, ExecutionClient, ExecutionContainer, ExecutionError


@pytest.fixture(scope="module")
async def workspace():
with tempfile.TemporaryDirectory() as temp_dir:
yield temp_dir


@pytest.fixture(
scope="module",
params=["test-root", "test"],
Expand Down

0 comments on commit 7d21249

Please sign in to comment.