Skip to content

Commit

Permalink
Add types for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Elliot Gunton <elliotgunton@gmail.com>
  • Loading branch information
elliotgunton committed Dec 9, 2024
1 parent b1d7171 commit 8e21c9b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tests/test_unit/test_script.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from pathlib import Path
from typing import Annotated, Dict, Optional, Union, cast
from typing import Annotated, Dict, List, Optional, Union, cast

import pytest

from hera.shared._global_config import _GlobalConfig
from hera.workflows._mixins import EnvT
from hera.workflows.artifact import Artifact
from hera.workflows.env import Env
from hera.workflows.io import Output
Expand Down Expand Up @@ -284,7 +286,7 @@ def my_script():
],
),
)
def test_runner_script_no_added_env_vars(self, user_env, expected_env):
def test_runner_script_no_added_env_vars(self, user_env: EnvT, expected_env):
built_workflow = self.build_workflow(user_env)

script_template = cast(ScriptTemplate, built_workflow.spec.templates[0].script)
Expand All @@ -309,7 +311,7 @@ def test_runner_script_no_added_env_vars(self, user_env, expected_env):
],
),
)
def test_runner_script_output_dir_env_var(self, user_env, expected_env):
def test_runner_script_output_dir_env_var(self, user_env: EnvT, expected_env: Optional[List[ModelEnvVar]]):
# GIVEN
constructor = RunnerScriptConstructor(outputs_directory="/my/tmp/dir")

Expand Down Expand Up @@ -337,7 +339,7 @@ def test_runner_script_output_dir_env_var(self, user_env, expected_env):
],
),
)
def test_runner_script_pydantic_mode_env_var(self, user_env, expected_env):
def test_runner_script_pydantic_mode_env_var(self, user_env: EnvT, expected_env: Optional[List[ModelEnvVar]]):
# GIVEN
constructor = RunnerScriptConstructor(pydantic_mode=1)

Expand Down Expand Up @@ -365,7 +367,12 @@ def test_runner_script_pydantic_mode_env_var(self, user_env, expected_env):
],
),
)
def test_runner_script_pydantic_io_env_var(self, global_config_fixture, user_env, expected_env):
def test_runner_script_pydantic_io_env_var(
self,
global_config_fixture: _GlobalConfig,
user_env: EnvT,
expected_env: Optional[List[ModelEnvVar]],
):
# GIVEN
global_config_fixture.experimental_features["script_pydantic_io"] = True
constructor = RunnerScriptConstructor()
Expand Down

0 comments on commit 8e21c9b

Please sign in to comment.