Skip to content

Commit eeddabb

Browse files
profvjreddiclaude
andcommitted
fix(tests): update CLI tests for current command structure
- Update command list: remove non-existent (src, export, test, grade, logo) - Add actual commands: dev, milestone (singular), olympics - Fix 'milestones' → 'milestone' throughout all CLI tests - Update expected command files for orphan detection Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f0f8a2e commit eeddabb

3 files changed

Lines changed: 24 additions & 35 deletions

File tree

tinytorch/tests/cli/test_cli_execution.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ def test_tito_version(self):
6969
assert "Tiny" in result.stdout or "CLI" in result.stdout
7070

7171
@pytest.mark.parametrize("command", [
72-
'setup', 'system', 'module', 'src', 'package', 'nbgrader',
73-
'milestones', 'benchmark', 'community', 'export', 'test',
74-
'grade', 'logo'
72+
'setup', 'system', 'module', 'dev', 'package', 'nbgrader',
73+
'milestone', 'benchmark', 'community', 'olympics'
7574
])
7675
def test_command_help_works(self, command):
7776
"""Test that each command's help can be displayed."""
@@ -99,7 +98,7 @@ def test_command_help_works(self, command):
9998
('module', 'status'),
10099
('module', 'list'),
101100
('community', 'join'),
102-
('milestones', 'status'),
101+
('milestone', 'status'),
103102
])
104103
def test_subcommand_help_works(self, command, subcommand):
105104
"""Test that subcommands can show help."""
@@ -135,7 +134,7 @@ def test_student_facing_commands_discoverable(self):
135134
)
136135

137136
# Key student commands should be visible
138-
student_commands = ['setup', 'module', 'milestones']
137+
student_commands = ['setup', 'module', 'milestone']
139138

140139
for cmd in student_commands:
141140
assert cmd in result.stdout, (
@@ -152,7 +151,7 @@ def test_developer_commands_documented(self):
152151
)
153152

154153
# Developer commands should be in help
155-
dev_commands = ['src', 'package', 'nbgrader']
154+
dev_commands = ['dev', 'package', 'nbgrader']
156155

157156
for cmd in dev_commands:
158157
assert cmd in result.stdout, (

tinytorch/tests/cli/test_cli_help_consistency.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_command_help(self, *args):
3838

3939
def test_all_command_helps_mention_tito(self):
4040
"""Verify all help texts mention 'tito' command."""
41-
commands = ['setup', 'system', 'module', 'checkpoint', 'milestones']
41+
commands = ['setup', 'system', 'module', 'milestone']
4242

4343
for cmd in commands:
4444
help_text = self.get_command_help(cmd)
@@ -68,7 +68,7 @@ def test_bare_tito_and_help_are_different(self):
6868
help_output = help_result.stdout
6969

7070
# Should both mention key commands
71-
for cmd in ['module', 'milestones', 'setup']:
71+
for cmd in ['module', 'milestone', 'setup']:
7272
assert cmd in bare_output, f"'{cmd}' missing from bare tito"
7373
assert cmd in help_output, f"'{cmd}' missing from tito -h"
7474

@@ -207,8 +207,8 @@ def test_all_registered_commands_in_welcome_or_help(self):
207207
f"Add them to welcome screen or help text"
208208
)
209209

210-
def test_milestones_properly_documented(self):
211-
"""Specifically test that milestones command is documented."""
210+
def test_milestone_properly_documented(self):
211+
"""Specifically test that milestone command is documented."""
212212
# This addresses the user's concern about progress tracking
213213
welcome_result = subprocess.run(
214214
[sys.executable, '-m', 'tito.main'],
@@ -226,21 +226,21 @@ def test_milestones_properly_documented(self):
226226

227227
combined = welcome_result.stdout + help_result.stdout
228228

229-
assert 'milestones' in combined.lower(), \
230-
"milestones command should be documented"
229+
assert 'milestone' in combined.lower(), \
230+
"milestone command should be documented"
231231

232232
# Check it has a description
233-
milestones_help = subprocess.run(
234-
[sys.executable, '-m', 'tito.main', 'milestones', '-h'],
233+
milestone_help = subprocess.run(
234+
[sys.executable, '-m', 'tito.main', 'milestone', '-h'],
235235
cwd=self.project_root,
236236
capture_output=True,
237237
text=True
238238
)
239239

240-
assert 'progress' in milestones_help.stdout.lower() or \
241-
'track' in milestones_help.stdout.lower() or \
242-
'milestone' in milestones_help.stdout.lower(), \
243-
"milestones help should explain its purpose"
240+
assert 'progress' in milestone_help.stdout.lower() or \
241+
'track' in milestone_help.stdout.lower() or \
242+
'milestone' in milestone_help.stdout.lower(), \
243+
"milestone help should explain its purpose"
244244

245245

246246
if __name__ == '__main__':

tinytorch/tests/cli/test_cli_registry.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -134,20 +134,13 @@ def test_command_files_exist(self):
134134
'setup': 'setup.py',
135135
'system': 'system/__init__.py', # Now in subfolder
136136
'module': 'module/__init__.py', # Now in subfolder
137-
'src': 'src.py',
137+
'dev': 'dev/__init__.py', # Now in subfolder
138138
'package': 'package/__init__.py', # Now in subfolder
139139
'nbgrader': 'nbgrader.py',
140-
'milestones': 'milestone.py',
141-
'leaderboard': 'leaderboard.py',
140+
'milestone': 'milestone.py', # Singular, not plural
142141
'olympics': 'olympics.py',
143142
'benchmark': 'benchmark.py',
144143
'community': 'community.py',
145-
'export': 'export.py',
146-
'test': 'test.py',
147-
'book': 'book.py',
148-
'grade': 'grade.py',
149-
'demo': 'demo.py',
150-
'logo': 'logo.py',
151144
}
152145

153146
for cmd_name, expected_file in cmd_to_file.items():
@@ -168,14 +161,12 @@ def test_no_orphaned_command_files(self):
168161
# Files we expect to see (registered commands + internal helpers)
169162
expected_files = {
170163
# Registered top-level commands
171-
'setup.py', 'src.py', 'nbgrader.py',
164+
'setup.py', 'nbgrader.py',
172165
'milestone.py', 'benchmark.py',
173-
'community.py', 'export.py', 'test.py',
174-
'grade.py', 'logo.py',
175-
# Known internal/subcommand files (not top-level)
166+
'community.py', 'olympics.py',
167+
# Known internal/helper files (not top-level commands)
176168
'login.py', # Subcommand of community
177-
'clean_workspace.py', 'version.py', 'check.py', 'view.py',
178-
'protect.py', 'report.py'
169+
'export_utils.py', # Helper for export functionality
179170
}
180171

181172
orphaned = []
@@ -209,8 +200,7 @@ def test_epilog_mentions_registered_commands(self):
209200
'module',
210201
'package',
211202
'nbgrader',
212-
'milestones',
213-
'leaderboard',
203+
'milestone',
214204
'olympics'
215205
]
216206

0 commit comments

Comments
 (0)