Skip to content

Commit 100e13c

Browse files
author
jiaxin.loh
committed
fix: remove e2e tests for edge cases
1 parent 41df82d commit 100e13c

3 files changed

Lines changed: 2 additions & 78 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ You are an expert software developer handling this repo.
1313
**Note**:
1414
- Git CLI commands should be taken from `git.py`.
1515
- GitHub CLI commands should be taken from `github_cli.py`.
16+
- E2E tests in `tests/e2e/` cover the happy path only. Do not add failure, edge case, or error handling tests there.
1617

1718
**File Structure**:
1819
- app/: CLI entry, commands, utils, configs, logging, hooks, __init__.py, cli.py, version.py
Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import json
22
from pathlib import Path
33

4-
from ..constants import EXERCISE_NAME, HANDS_ON_NAME
5-
from ..runner import BinaryRunner
4+
from ..constants import EXERCISE_NAME
65

76

87
def test_download_exercise(downloaded_exercise_dir: Path) -> None:
@@ -19,68 +18,3 @@ def test_download_exercise(downloaded_exercise_dir: Path) -> None:
1918
def test_download_hands_on(downloaded_hands_on_dir: Path) -> None:
2019
"""download creates the hands-on folder."""
2120
assert downloaded_hands_on_dir.is_dir()
22-
23-
24-
def test_download_blocks_when_already_downloaded(
25-
runner: BinaryRunner, gitmastery_root: Path, downloaded_exercise_dir: Path
26-
) -> None:
27-
"""download refuses to overwrite an existing exercise folder."""
28-
sentinel = downloaded_exercise_dir / "NOTES.md"
29-
sentinel.write_text("local work")
30-
31-
try:
32-
res = runner.run(["download", EXERCISE_NAME], cwd=gitmastery_root)
33-
34-
assert res.returncode != 0, (
35-
f"Expected a non-zero exit code, got {res.returncode}\n"
36-
f"stdout:\n{res.stdout}"
37-
)
38-
res.assert_stdout_contains("already have")
39-
res.assert_stdout_contains("--force")
40-
41-
assert sentinel.is_file()
42-
assert sentinel.read_text() == "local work"
43-
finally:
44-
sentinel.unlink()
45-
46-
47-
def test_download_hands_on_blocks_when_already_downloaded(
48-
runner: BinaryRunner, gitmastery_root: Path, downloaded_hands_on_dir: Path
49-
) -> None:
50-
"""download refuses to overwrite an existing hands-on folder."""
51-
sentinel = downloaded_hands_on_dir / "NOTES.md"
52-
sentinel.write_text("local work")
53-
54-
try:
55-
res = runner.run(["download", HANDS_ON_NAME], cwd=gitmastery_root)
56-
57-
assert res.returncode != 0, (
58-
f"Expected a non-zero exit code, got {res.returncode}\n"
59-
f"stdout:\n{res.stdout}"
60-
)
61-
res.assert_stdout_contains("--force")
62-
63-
assert sentinel.is_file()
64-
finally:
65-
sentinel.unlink()
66-
67-
68-
def test_download_force_overwrites(
69-
runner: BinaryRunner, isolated_gitmastery_root: Path
70-
) -> None:
71-
"""download --force wipes the existing exercise folder and downloads it again."""
72-
runner.run(
73-
["download", EXERCISE_NAME], cwd=isolated_gitmastery_root
74-
).assert_success()
75-
76-
exercise_dir = isolated_gitmastery_root / EXERCISE_NAME
77-
sentinel = exercise_dir / "NOTES.md"
78-
sentinel.write_text("local work")
79-
80-
runner.run(
81-
["download", EXERCISE_NAME, "--force"], cwd=isolated_gitmastery_root
82-
).assert_success()
83-
84-
assert not sentinel.exists()
85-
assert (exercise_dir / ".gitmastery-exercise.json").is_file()
86-
assert (exercise_dir / "README.md").is_file()

tests/e2e/conftest.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ def setup_gitmastery_root(
5353
yield from _make_gitmastery_root(runner, tmp_path_factory)
5454

5555

56-
@pytest.fixture
57-
def isolated_gitmastery_root(
58-
runner: BinaryRunner, tmp_path_factory: pytest.TempPathFactory
59-
) -> Generator[Path, None, None]:
60-
"""
61-
A throwaway Git-Mastery root for tests that overwrite a downloaded exercise,
62-
so that they do not disturb the session-scoped fixtures below.
63-
"""
64-
yield from _make_gitmastery_root(runner, tmp_path_factory)
65-
66-
6756
@pytest.fixture(scope="session")
6857
def downloaded_exercise_dir(runner: BinaryRunner, gitmastery_root: Path) -> Path:
6958
"""

0 commit comments

Comments
 (0)