Skip to content

Commit 849b309

Browse files
mnriemCopilot
andcommitted
fix(github): isolate resolver tests and correct install link
Assisted-by: GitHub Copilot (model: GPT-6 Sol, autonomous) Co-authored-by: Copilot App <[email protected]>
1 parent 04030cf commit 849b309

2 files changed

Lines changed: 34 additions & 15 deletions

File tree

‎docs/installation.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ After initialization, you should see the following commands available in your co
152152

153153
The `generic` integration scaffolds core commands or skills, but does not
154154
register extension add-ons; installing `github` there does not make its
155-
replacement command invokable. See the [GitHub extension's installation notes](../extensions/github/README.md#installation).
155+
replacement command invokable. See the [GitHub extension's installation notes](https://github.com/github/spec-kit/blob/main/extensions/github/README.md#installation).
156156

157157
Scripts are installed into a variant subdirectory matching the chosen script type:
158158

‎tests/extensions/github/test_github_extension.py‎

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -650,8 +650,19 @@ def _make_feature_project(tmp_path: Path) -> Path:
650650
return project
651651

652652

653+
def _resolver_env() -> dict[str, str]:
654+
"""Environment without inherited project or feature overrides."""
655+
env = dict(os.environ)
656+
env.pop("SPECIFY_FEATURE_DIRECTORY", None)
657+
env.pop("SPECIFY_INIT_DIR", None)
658+
env.pop("SPECIFY_FEATURE_NO_PERSIST", None)
659+
return env
660+
661+
653662
def _run(cmd: list[str], cwd: Path) -> subprocess.CompletedProcess:
654-
return subprocess.run(cmd, cwd=cwd, capture_output=True, text=True)
663+
return subprocess.run(
664+
cmd, cwd=cwd, capture_output=True, text=True, env=_resolver_env()
665+
)
655666

656667

657668
class TestResolveTasksPython:
@@ -665,6 +676,24 @@ def test_reports_feature_dir_tasks_and_docs(self, tmp_path: Path):
665676
assert Path(payload["TASKS"]) == project / "specs" / "001-demo" / "tasks.md"
666677
assert payload["AVAILABLE_DOCS"] == ["research.md", "tasks.md"]
667678

679+
def test_ignores_inherited_resolver_overrides(
680+
self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
681+
):
682+
project = _make_feature_project(tmp_path)
683+
feature_json = project / ".specify" / "feature.json"
684+
before = feature_json.read_bytes()
685+
monkeypatch.setenv("SPECIFY_INIT_DIR", str(tmp_path / "missing"))
686+
monkeypatch.setenv("SPECIFY_FEATURE_DIRECTORY", "specs/missing")
687+
monkeypatch.setenv("SPECIFY_FEATURE_NO_PERSIST", "1")
688+
689+
result = _run([sys.executable, str(PY_SCRIPT), "--json"], project)
690+
691+
assert result.returncode == 0, result.stderr
692+
assert Path(json.loads(result.stdout)["FEATURE_DIR"]) == (
693+
project / "specs" / "001-demo"
694+
)
695+
assert feature_json.read_bytes() == before
696+
668697
def test_errors_when_tasks_md_is_missing(self, tmp_path: Path):
669698
project = _make_feature_project(tmp_path)
670699
(project / "specs" / "001-demo" / "tasks.md").unlink()
@@ -683,7 +712,7 @@ def test_text_mode_survives_a_cp1252_stdout(self, tmp_path: Path):
683712
aborted the report right after ``AVAILABLE_DOCS:``.
684713
"""
685714
project = _make_feature_project(tmp_path)
686-
env = {**os.environ, "PYTHONIOENCODING": "cp1252"}
715+
env = {**_resolver_env(), "PYTHONIOENCODING": "cp1252"}
687716
result = subprocess.run(
688717
[sys.executable, str(PY_SCRIPT)],
689718
cwd=project,
@@ -719,8 +748,7 @@ def test_json_mode_survives_a_cp1252_stdout_with_a_non_ascii_path(
719748
(feature / "plan.md").write_text("# Plan\n", encoding="utf-8")
720749
(feature / "tasks.md").write_text("- [ ] T001 Task\n", encoding="utf-8")
721750

722-
env = {**os.environ, "PYTHONIOENCODING": "cp1252"}
723-
env.pop("SPECIFY_FEATURE_DIRECTORY", None)
751+
env = {**_resolver_env(), "PYTHONIOENCODING": "cp1252"}
724752
result = subprocess.run(
725753
[sys.executable, str(PY_SCRIPT), "--json"],
726754
cwd=project,
@@ -741,7 +769,7 @@ def test_text_mode_uses_the_glyph_when_stdout_can_encode_it(
741769
self, tmp_path: Path
742770
):
743771
project = _make_feature_project(tmp_path)
744-
env = {**os.environ, "PYTHONIOENCODING": "utf-8"}
772+
env = {**_resolver_env(), "PYTHONIOENCODING": "utf-8"}
745773
result = subprocess.run(
746774
[sys.executable, str(PY_SCRIPT)],
747775
cwd=project,
@@ -766,15 +794,6 @@ def test_does_not_write_feature_json_without_an_override(self, tmp_path: Path):
766794
assert feature_json.read_bytes() == before
767795

768796

769-
def _resolver_env() -> dict[str, str]:
770-
"""Environment without inherited project or feature overrides."""
771-
env = dict(os.environ)
772-
env.pop("SPECIFY_FEATURE_DIRECTORY", None)
773-
env.pop("SPECIFY_INIT_DIR", None)
774-
env.pop("SPECIFY_FEATURE_NO_PERSIST", None)
775-
return env
776-
777-
778797
def _run_ps(project: Path) -> subprocess.CompletedProcess:
779798
return subprocess.run(
780799
[POWERSHELL_EXE, "-NoProfile", "-File", str(PS_SCRIPT), "-Json"],

0 commit comments

Comments
 (0)