@@ -65,18 +65,24 @@ def main() -> None:
6565 repo = sys .argv [2 ]
6666 commit0 .harness .get_pytest_ids .main (repo , stdout = True )
6767 elif command == "test" or command == "test-reference" :
68- if command == "test" and len (sys .argv ) < 5 :
69- raise ValueError (f"An argument is missing for commit0 test.\n Usage: commit0 test {{repo_dir}} {{branch}} {{test_ids}}" )
70- elif command == "test" and len (sys .argv ) > 5 :
71- raise ValueError (f"Too many arguments are passed to commit0 test.\n Usage: commit0 test {{repo_dir}} {{branch}} {{test_ids}}" )
7268 # this command assume execution in arbitrary working directory
7369 repo_or_repo_path = sys .argv [2 ]
74- branch = sys .argv [3 ]
75- test_ids = sys .argv [4 ]
70+ if command == "test-reference" :
71+ if len (sys .argv ) < 4 :
72+ raise ValueError (f"An argument is missing for commit0 test-reference.\n Usage: commit0 test-reference {{repo_dir}} {{test_ids}}" )
73+ elif len (sys .argv ) > 4 :
74+ raise ValueError (f"Too many arguments are passed to commit0 test-reference.\n Usage: commit0 test-reference {{repo_dir}} {{test_ids}}" )
75+ branch = "reference"
76+ test_ids = sys .argv [3 ]
77+ else :
78+ if len (sys .argv ) < 5 :
79+ raise ValueError (f"An argument is missing for commit0 test.\n Usage: commit0 test {{repo_dir}} {{branch}} {{test_ids}}" )
80+ elif len (sys .argv ) > 5 :
81+ raise ValueError (f"Too many arguments are passed to commit0 test.\n Usage: commit0 test {{repo_dir}} {{branch}} {{test_ids}}" )
82+ branch = sys .argv [3 ]
83+ test_ids = sys .argv [4 ]
7684 if branch .startswith ("branch=" ):
7785 branch = branch [len ("branch=" ):]
78- if command == "test-reference" :
79- config .branch = "reference"
8086 commit0 .harness .run_pytest_ids .main (
8187 config .dataset_name ,
8288 config .dataset_split ,
@@ -90,13 +96,17 @@ def main() -> None:
9096 stdout = True ,
9197 )
9298 elif command == "evaluate" or command == "evaluate-reference" :
93- if command == "evaluate" and len (sys .argv ) < 4 :
94- raise ValueError (f"An argument is missing for commit0 test.\n Usage: commit0 test {{repo_dir}} {{branch}} {{test_ids}}" )
95- elif command == "evaluate" and len (sys .argv ) > 4 :
96- raise ValueError (f"Too many arguments are passed to commit0 test.\n Usage: commit0 test {{repo_dir}} {{branch}} {{test_ids}}" )
9799 if command == "evaluate-reference" :
100+ if len (sys .argv ) < 3 :
101+ raise ValueError (f"An argument is missing for commit0 evaluate-reference.\n Usage: commit0 evaluate-reference {{repo_split}}" )
102+ elif len (sys .argv ) > 3 :
103+ raise ValueError (f"Too many arguments are passed to commit0 evaluate-reference.\n Usage: commit0 evaluate-reference {{repo_split}}" )
98104 branch = "reference"
99105 else :
106+ if len (sys .argv ) < 4 :
107+ raise ValueError (f"An argument is missing for commit0 evaluate.\n Usage: commit0 evaluate {{repo_split}} {{branch}}" )
108+ elif len (sys .argv ) > 4 :
109+ raise ValueError (f"Too many arguments are passed to commit0 evaluate.\n Usage: commit0 evaluate {{repo_split}} {{branch}}" )
100110 branch = sys .argv [3 ]
101111 commit0 .harness .evaluate .main (
102112 config .dataset_name ,
0 commit comments