Skip to content

Commit f48b81d

Browse files
committed
[test]: add basic unit test for the generic pipeline runner
1 parent e900cc6 commit f48b81d

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import subprocess
2+
import sys
3+
4+
def test_runner_help():
5+
# Run the runner with --help to ensure it parses arguments correctly
6+
# and doesn't have any syntax errors or missing imports.
7+
result = subprocess.run(
8+
[sys.executable, "-m", "fastvideo.training.runner", "--help"],
9+
capture_output=True,
10+
text=True
11+
)
12+
13+
# Check if the process completed successfully
14+
assert result.returncode == 0, f"Runner failed with exit code {result.returncode}.\nStderr: {result.stderr}"
15+
16+
# Check if help output is printed
17+
assert "--pipeline_class" in result.stdout
18+
assert "--pipeline_module" in result.stdout

fastvideo/training/runner.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ def main(args) -> None:
2222

2323
if __name__ == "__main__":
2424
parser = FlexibleArgumentParser()
25-
parser.add_argument("--pipeline_class", type=str, required=True, help="Name of the pipeline class to run, e.g., WanTrainingPipeline")
26-
parser.add_argument("--pipeline_module", type=str, required=True, help="Module containing the pipeline class, e.g., fastvideo.training.wan_training_pipeline")
25+
parser.add_argument("--pipeline_class",
26+
type=str,
27+
required=True,
28+
help="Name of the pipeline class to run, e.g., WanTrainingPipeline")
29+
parser.add_argument("--pipeline_module",
30+
type=str,
31+
required=True,
32+
help="Module containing the pipeline class, e.g., fastvideo.training.wan_training_pipeline")
2733
parser = TrainingArgs.add_cli_args(parser)
2834
parser = FastVideoArgs.add_cli_args(parser)
2935

0 commit comments

Comments
 (0)