Skip to content

Commit 28e85c4

Browse files
committed
refactor: move file inventory tests from test_cli to test_copilot
File inventories are copilot-specific. test_cli.py now only tests CLI flag mechanics (mutual exclusivity, unknown rejection, auto-promote).
1 parent d1842d5 commit 28e85c4

File tree

2 files changed

+121
-120
lines changed

2 files changed

+121
-120
lines changed

tests/integrations/test_cli.py

Lines changed: 0 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -77,123 +77,3 @@ def test_ai_copilot_auto_promotes(self, tmp_path):
7777
assert result.exit_code == 0
7878
assert "--integration copilot" in result.output
7979
assert (project / ".github" / "agents" / "speckit.plan.agent.md").exists()
80-
81-
def test_complete_file_inventory_sh(self, tmp_path):
82-
"""Every file produced by --integration copilot --script sh."""
83-
from typer.testing import CliRunner
84-
from specify_cli import app
85-
project = tmp_path / "inventory-sh"
86-
project.mkdir()
87-
old_cwd = os.getcwd()
88-
try:
89-
os.chdir(project)
90-
result = CliRunner().invoke(app, [
91-
"init", "--here", "--integration", "copilot", "--script", "sh", "--no-git",
92-
], catch_exceptions=False)
93-
finally:
94-
os.chdir(old_cwd)
95-
assert result.exit_code == 0
96-
actual = sorted(str(p.relative_to(project)) for p in project.rglob("*") if p.is_file())
97-
expected = sorted([
98-
".github/agents/speckit.analyze.agent.md",
99-
".github/agents/speckit.checklist.agent.md",
100-
".github/agents/speckit.clarify.agent.md",
101-
".github/agents/speckit.constitution.agent.md",
102-
".github/agents/speckit.implement.agent.md",
103-
".github/agents/speckit.plan.agent.md",
104-
".github/agents/speckit.specify.agent.md",
105-
".github/agents/speckit.tasks.agent.md",
106-
".github/agents/speckit.taskstoissues.agent.md",
107-
".github/prompts/speckit.analyze.prompt.md",
108-
".github/prompts/speckit.checklist.prompt.md",
109-
".github/prompts/speckit.clarify.prompt.md",
110-
".github/prompts/speckit.constitution.prompt.md",
111-
".github/prompts/speckit.implement.prompt.md",
112-
".github/prompts/speckit.plan.prompt.md",
113-
".github/prompts/speckit.specify.prompt.md",
114-
".github/prompts/speckit.tasks.prompt.md",
115-
".github/prompts/speckit.taskstoissues.prompt.md",
116-
".vscode/settings.json",
117-
".specify/integration.json",
118-
".specify/init-options.json",
119-
".specify/integrations/copilot.manifest.json",
120-
".specify/integrations/speckit.manifest.json",
121-
".specify/integrations/copilot/scripts/update-context.ps1",
122-
".specify/integrations/copilot/scripts/update-context.sh",
123-
".specify/scripts/bash/check-prerequisites.sh",
124-
".specify/scripts/bash/common.sh",
125-
".specify/scripts/bash/create-new-feature.sh",
126-
".specify/scripts/bash/setup-plan.sh",
127-
".specify/scripts/bash/update-agent-context.sh",
128-
".specify/templates/agent-file-template.md",
129-
".specify/templates/checklist-template.md",
130-
".specify/templates/constitution-template.md",
131-
".specify/templates/plan-template.md",
132-
".specify/templates/spec-template.md",
133-
".specify/templates/tasks-template.md",
134-
".specify/memory/constitution.md",
135-
])
136-
assert actual == expected, (
137-
f"Missing: {sorted(set(expected) - set(actual))}\n"
138-
f"Extra: {sorted(set(actual) - set(expected))}"
139-
)
140-
141-
def test_complete_file_inventory_ps(self, tmp_path):
142-
"""Every file produced by --integration copilot --script ps."""
143-
from typer.testing import CliRunner
144-
from specify_cli import app
145-
project = tmp_path / "inventory-ps"
146-
project.mkdir()
147-
old_cwd = os.getcwd()
148-
try:
149-
os.chdir(project)
150-
result = CliRunner().invoke(app, [
151-
"init", "--here", "--integration", "copilot", "--script", "ps", "--no-git",
152-
], catch_exceptions=False)
153-
finally:
154-
os.chdir(old_cwd)
155-
assert result.exit_code == 0
156-
actual = sorted(str(p.relative_to(project)) for p in project.rglob("*") if p.is_file())
157-
expected = sorted([
158-
".github/agents/speckit.analyze.agent.md",
159-
".github/agents/speckit.checklist.agent.md",
160-
".github/agents/speckit.clarify.agent.md",
161-
".github/agents/speckit.constitution.agent.md",
162-
".github/agents/speckit.implement.agent.md",
163-
".github/agents/speckit.plan.agent.md",
164-
".github/agents/speckit.specify.agent.md",
165-
".github/agents/speckit.tasks.agent.md",
166-
".github/agents/speckit.taskstoissues.agent.md",
167-
".github/prompts/speckit.analyze.prompt.md",
168-
".github/prompts/speckit.checklist.prompt.md",
169-
".github/prompts/speckit.clarify.prompt.md",
170-
".github/prompts/speckit.constitution.prompt.md",
171-
".github/prompts/speckit.implement.prompt.md",
172-
".github/prompts/speckit.plan.prompt.md",
173-
".github/prompts/speckit.specify.prompt.md",
174-
".github/prompts/speckit.tasks.prompt.md",
175-
".github/prompts/speckit.taskstoissues.prompt.md",
176-
".vscode/settings.json",
177-
".specify/integration.json",
178-
".specify/init-options.json",
179-
".specify/integrations/copilot.manifest.json",
180-
".specify/integrations/speckit.manifest.json",
181-
".specify/integrations/copilot/scripts/update-context.ps1",
182-
".specify/integrations/copilot/scripts/update-context.sh",
183-
".specify/scripts/powershell/check-prerequisites.ps1",
184-
".specify/scripts/powershell/common.ps1",
185-
".specify/scripts/powershell/create-new-feature.ps1",
186-
".specify/scripts/powershell/setup-plan.ps1",
187-
".specify/scripts/powershell/update-agent-context.ps1",
188-
".specify/templates/agent-file-template.md",
189-
".specify/templates/checklist-template.md",
190-
".specify/templates/constitution-template.md",
191-
".specify/templates/plan-template.md",
192-
".specify/templates/spec-template.md",
193-
".specify/templates/tasks-template.md",
194-
".specify/memory/constitution.md",
195-
])
196-
assert actual == expected, (
197-
f"Missing: {sorted(set(expected) - set(actual))}\n"
198-
f"Extra: {sorted(set(actual) - set(expected))}"
199-
)

tests/integrations/test_copilot.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for CopilotIntegration."""
22

33
import json
4+
import os
45

56
from specify_cli.integrations import get_integration
67
from specify_cli.integrations.manifest import IntegrationManifest
@@ -144,3 +145,123 @@ def test_templates_are_processed(self, tmp_path):
144145
assert "{ARGS}" not in content, f"{agent_file.name} has unprocessed {{ARGS}}"
145146
assert "\nscripts:\n" not in content
146147
assert "\nagent_scripts:\n" not in content
148+
149+
def test_complete_file_inventory_sh(self, tmp_path):
150+
"""Every file produced by specify init --integration copilot --script sh."""
151+
from typer.testing import CliRunner
152+
from specify_cli import app
153+
project = tmp_path / "inventory-sh"
154+
project.mkdir()
155+
old_cwd = os.getcwd()
156+
try:
157+
os.chdir(project)
158+
result = CliRunner().invoke(app, [
159+
"init", "--here", "--integration", "copilot", "--script", "sh", "--no-git",
160+
], catch_exceptions=False)
161+
finally:
162+
os.chdir(old_cwd)
163+
assert result.exit_code == 0
164+
actual = sorted(str(p.relative_to(project)) for p in project.rglob("*") if p.is_file())
165+
expected = sorted([
166+
".github/agents/speckit.analyze.agent.md",
167+
".github/agents/speckit.checklist.agent.md",
168+
".github/agents/speckit.clarify.agent.md",
169+
".github/agents/speckit.constitution.agent.md",
170+
".github/agents/speckit.implement.agent.md",
171+
".github/agents/speckit.plan.agent.md",
172+
".github/agents/speckit.specify.agent.md",
173+
".github/agents/speckit.tasks.agent.md",
174+
".github/agents/speckit.taskstoissues.agent.md",
175+
".github/prompts/speckit.analyze.prompt.md",
176+
".github/prompts/speckit.checklist.prompt.md",
177+
".github/prompts/speckit.clarify.prompt.md",
178+
".github/prompts/speckit.constitution.prompt.md",
179+
".github/prompts/speckit.implement.prompt.md",
180+
".github/prompts/speckit.plan.prompt.md",
181+
".github/prompts/speckit.specify.prompt.md",
182+
".github/prompts/speckit.tasks.prompt.md",
183+
".github/prompts/speckit.taskstoissues.prompt.md",
184+
".vscode/settings.json",
185+
".specify/integration.json",
186+
".specify/init-options.json",
187+
".specify/integrations/copilot.manifest.json",
188+
".specify/integrations/speckit.manifest.json",
189+
".specify/integrations/copilot/scripts/update-context.ps1",
190+
".specify/integrations/copilot/scripts/update-context.sh",
191+
".specify/scripts/bash/check-prerequisites.sh",
192+
".specify/scripts/bash/common.sh",
193+
".specify/scripts/bash/create-new-feature.sh",
194+
".specify/scripts/bash/setup-plan.sh",
195+
".specify/scripts/bash/update-agent-context.sh",
196+
".specify/templates/agent-file-template.md",
197+
".specify/templates/checklist-template.md",
198+
".specify/templates/constitution-template.md",
199+
".specify/templates/plan-template.md",
200+
".specify/templates/spec-template.md",
201+
".specify/templates/tasks-template.md",
202+
".specify/memory/constitution.md",
203+
])
204+
assert actual == expected, (
205+
f"Missing: {sorted(set(expected) - set(actual))}\n"
206+
f"Extra: {sorted(set(actual) - set(expected))}"
207+
)
208+
209+
def test_complete_file_inventory_ps(self, tmp_path):
210+
"""Every file produced by specify init --integration copilot --script ps."""
211+
from typer.testing import CliRunner
212+
from specify_cli import app
213+
project = tmp_path / "inventory-ps"
214+
project.mkdir()
215+
old_cwd = os.getcwd()
216+
try:
217+
os.chdir(project)
218+
result = CliRunner().invoke(app, [
219+
"init", "--here", "--integration", "copilot", "--script", "ps", "--no-git",
220+
], catch_exceptions=False)
221+
finally:
222+
os.chdir(old_cwd)
223+
assert result.exit_code == 0
224+
actual = sorted(str(p.relative_to(project)) for p in project.rglob("*") if p.is_file())
225+
expected = sorted([
226+
".github/agents/speckit.analyze.agent.md",
227+
".github/agents/speckit.checklist.agent.md",
228+
".github/agents/speckit.clarify.agent.md",
229+
".github/agents/speckit.constitution.agent.md",
230+
".github/agents/speckit.implement.agent.md",
231+
".github/agents/speckit.plan.agent.md",
232+
".github/agents/speckit.specify.agent.md",
233+
".github/agents/speckit.tasks.agent.md",
234+
".github/agents/speckit.taskstoissues.agent.md",
235+
".github/prompts/speckit.analyze.prompt.md",
236+
".github/prompts/speckit.checklist.prompt.md",
237+
".github/prompts/speckit.clarify.prompt.md",
238+
".github/prompts/speckit.constitution.prompt.md",
239+
".github/prompts/speckit.implement.prompt.md",
240+
".github/prompts/speckit.plan.prompt.md",
241+
".github/prompts/speckit.specify.prompt.md",
242+
".github/prompts/speckit.tasks.prompt.md",
243+
".github/prompts/speckit.taskstoissues.prompt.md",
244+
".vscode/settings.json",
245+
".specify/integration.json",
246+
".specify/init-options.json",
247+
".specify/integrations/copilot.manifest.json",
248+
".specify/integrations/speckit.manifest.json",
249+
".specify/integrations/copilot/scripts/update-context.ps1",
250+
".specify/integrations/copilot/scripts/update-context.sh",
251+
".specify/scripts/powershell/check-prerequisites.ps1",
252+
".specify/scripts/powershell/common.ps1",
253+
".specify/scripts/powershell/create-new-feature.ps1",
254+
".specify/scripts/powershell/setup-plan.ps1",
255+
".specify/scripts/powershell/update-agent-context.ps1",
256+
".specify/templates/agent-file-template.md",
257+
".specify/templates/checklist-template.md",
258+
".specify/templates/constitution-template.md",
259+
".specify/templates/plan-template.md",
260+
".specify/templates/spec-template.md",
261+
".specify/templates/tasks-template.md",
262+
".specify/memory/constitution.md",
263+
])
264+
assert actual == expected, (
265+
f"Missing: {sorted(set(expected) - set(actual))}\n"
266+
f"Extra: {sorted(set(actual) - set(expected))}"
267+
)

0 commit comments

Comments
 (0)