@@ -519,6 +519,12 @@ def task_example() -> Annotated[Dict[str, str], PythonNode(name="result")]:
519
519
tmp_path .joinpath ("task_module.py" ).write_text (textwrap .dedent (source ))
520
520
result = runner .invoke (cli , [tmp_path .as_posix ()])
521
521
assert result .exit_code == ExitCode .OK
522
+ assert "1 Succeeded" in result .output
523
+
524
+ # Test that python nodes are recreated every run.
525
+ result = runner .invoke (cli , [tmp_path .as_posix ()])
526
+ assert result .exit_code == ExitCode .OK
527
+ assert "1 Succeeded" in result .output
522
528
523
529
524
530
@pytest .mark .end_to_end ()
@@ -544,10 +550,6 @@ def task_example() -> Annotated[Dict[str, str], nodes]:
544
550
assert result .exit_code == ExitCode .OK
545
551
assert "1 Succeeded" in result .output
546
552
547
- result = runner .invoke (cli , [tmp_path .as_posix ()])
548
- assert result .exit_code == ExitCode .OK
549
- assert "1 Skipped" in result .output
550
-
551
553
552
554
@pytest .mark .end_to_end ()
553
555
def test_more_nested_pytree_and_python_node_as_return (runner , tmp_path ):
@@ -568,15 +570,10 @@ def task_example() -> Annotated[Dict[str, str], nodes]:
568
570
assert result .exit_code == ExitCode .OK
569
571
assert "1 Succeeded" in result .output
570
572
571
- result = runner .invoke (cli , [tmp_path .as_posix ()])
572
- assert result .exit_code == ExitCode .OK
573
- assert "1 Skipped" in result .output
574
-
575
573
576
574
@pytest .mark .end_to_end ()
577
575
def test_execute_tasks_and_pass_values_only_by_python_nodes (runner , tmp_path ):
578
576
source = """
579
- from pytask import PathNode
580
577
from pytask import PythonNode
581
578
from typing_extensions import Annotated
582
579
from pathlib import Path
@@ -586,9 +583,9 @@ def test_execute_tasks_and_pass_values_only_by_python_nodes(runner, tmp_path):
586
583
def task_create_text() -> Annotated[int, node_text]:
587
584
return "This is the text."
588
585
589
- node_file = PathNode(path=Path("file.txt"))
590
-
591
- def task_create_file(text: Annotated[int, node_text] ) -> Annotated[str, node_file ]:
586
+ def task_create_file(
587
+ text: Annotated[int, node_text]
588
+ ) -> Annotated[str, Path("file.txt") ]:
592
589
return text
593
590
"""
594
591
tmp_path .joinpath ("task_module.py" ).write_text (textwrap .dedent (source ))
@@ -611,9 +608,9 @@ def test_execute_tasks_via_functional_api(tmp_path):
611
608
def create_text() -> Annotated[int, node_text]:
612
609
return "This is the text."
613
610
614
- node_file = PathNode(path=Path("file.txt"))
615
-
616
- def create_file(content: Annotated[str, node_text] ) -> Annotated[str, node_file ]:
611
+ def create_file(
612
+ content: Annotated[str, node_text]
613
+ ) -> Annotated[str, Path("file.txt") ]:
617
614
return content
618
615
619
616
if __name__ == "__main__":
0 commit comments