Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
Signed-off-by: Future-Outlier <eric901201@gmail.com>
  • Loading branch information
Future-Outlier committed Mar 18, 2024
1 parent 3137f33 commit 10d8b20
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions tests/flytekit/unit/core/test_container_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,33 @@

def test_local_execution():
try:
import docker

docker.from_env()
calculate_ellipse_area_python = ContainerTask(
name="calculate_ellipse_area_python",
input_data_dir="/var/inputs",
output_data_dir="/var/outputs",
inputs=kwtypes(a=float, b=float),
outputs=kwtypes(area=float, metadata=str),
image="ghcr.io/flyteorg/rawcontainers-python:v2",
command=[
"python",
"calculate-ellipse-area.py",
"{{.inputs.a}}",
"{{.inputs.b}}",
"/var/outputs",
],
)

def wf() -> Tuple[float, str]:
return calculate_ellipse_area_python(a=3.0, b=4.0)

area, metadata = wf()
assert area == 37.69911184307752
assert metadata == "[from python rawcontainer]"
except Exception as e:
# Currently, Ubuntu will pass the test, but MacOS and Windows will not
print(f"Skipping test due to Docker environment setup failure: {e}")
return

calculate_ellipse_area_python = ContainerTask(
name="calculate_ellipse_area_python",
input_data_dir="/var/inputs",
output_data_dir="/var/outputs",
inputs=kwtypes(a=float, b=float),
outputs=kwtypes(area=float, metadata=str),
image="ghcr.io/flyteorg/rawcontainers-python:v2",
command=[
"python",
"calculate-ellipse-area.py",
"{{.inputs.a}}",
"{{.inputs.b}}",
"/var/outputs",
],
)

def wf() -> Tuple[float, str]:
return calculate_ellipse_area_python(a=3.0, b=4.0)

area, metadata = wf()
assert area == 37.69911184307752
assert metadata == "[from python rawcontainer]"


def test_pod_template():
ps = V1PodSpec(
Expand Down

0 comments on commit 10d8b20

Please sign in to comment.