Skip to content

Commit

Permalink
Tidy up runner tests (#996)
Browse files Browse the repository at this point in the history
While working on #991 I found the runner tests quite messy. This PR
cleans up the `test_runner.py` file (changes are in test files only).

* global_config doesn't need setting when using the runner, only the
environment variables
* Use monkeypatch.setenv instead of os.environ
* Remove environ_annotations_fixture to make tests more explicit/obvious

Signed-off-by: Elliot Gunton <[email protected]>
  • Loading branch information
elliotgunton authored Mar 6, 2024
1 parent e50e29f commit eed2294
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 142 deletions.
9 changes: 0 additions & 9 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

import pytest

from hera.shared import global_config
Expand All @@ -10,10 +8,3 @@ def global_config_fixture():
global_config.reset()
yield global_config
global_config.reset()


@pytest.fixture
def environ_annotations_fixture():
os.environ["hera__script_annotations"] = ""
yield
del os.environ["hera__script_annotations"]
2 changes: 1 addition & 1 deletion tests/script_runner/annotated_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def empty_str_param() -> Annotated[str, Parameter(name="empty-str")]:


@script()
def none_param() -> Annotated[type(None), Parameter(name="null-str")]:
def none_param() -> Annotated[type(None), Parameter(name="null-str")]: # type: ignore
return None


Expand Down
Loading

0 comments on commit eed2294

Please sign in to comment.