Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ a key, add `--voice Aman` to narrate with a macOS voice instead.
<!-- graduates:start -->
**3 graduates** finished the course with a pull request merged in a real open source project. The most recent is first. [See the wall](graduates/) · [Join them](lessons/15-capstone/)

<a href="https://github.com/divya0795"><img src="https://github.com/divya0795.png?size=96" width="48" height="48" alt="@divya0795" title="Divya"></a>
<a href="https://github.com/karthikaun"><img src="https://github.com/karthikaun.png?size=96" width="48" height="48" alt="@karthikaun" title="Karthik"></a>
<a href="https://github.com/divya0795"><img src="https://github.com/divya0795.png?size=96" width="48" height="48" alt="@divya0795" title="Divya"></a>
<a href="https://github.com/thejesh23"><img src="https://github.com/thejesh23.png?size=96" width="48" height="48" alt="@thejesh23" title="Thejesh"></a>
<!-- graduates:end -->

Expand Down
4 changes: 2 additions & 2 deletions graduates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ This page is generated by `tools/graduates_wall.py`. Don't edit it by hand.

**3 graduates**, the most recent first.

<a href="https://github.com/divya0795"><img src="https://github.com/divya0795.png?size=128" width="64" height="64" alt="@divya0795" title="Divya"></a>
<a href="https://github.com/karthikaun"><img src="https://github.com/karthikaun.png?size=128" width="64" height="64" alt="@karthikaun" title="Karthik"></a>
<a href="https://github.com/divya0795"><img src="https://github.com/divya0795.png?size=128" width="64" height="64" alt="@divya0795" title="Divya"></a>
<a href="https://github.com/thejesh23"><img src="https://github.com/thejesh23.png?size=128" width="64" height="64" alt="@thejesh23" title="Thejesh"></a>

| Name | GitHub | Contribution | Message |
|---|---|---|---|
| Divya | [@divya0795](https://github.com/divya0795) | [psf/black#5711](https://github.com/psf/black/pull/5711) | Made Black reject --line-ranges for notebooks detected by their .ipynb extension. |
| Karthik | [@karthikaun](https://github.com/karthikaun) | [thejesh23/graduation-test-project#1](https://github.com/thejesh23/graduation-test-project/pull/1) | Fixed a typo in a greeting script \(a test of the graduation flow\). |
| Divya | [@divya0795](https://github.com/divya0795) | [psf/black#5711](https://github.com/psf/black/pull/5711) | Made Black reject --line-ranges for notebooks detected by their .ipynb extension. |
| Thejesh | [@thejesh23](https://github.com/thejesh23) | [python/cpython#162029](https://github.com/python/cpython/pull/162029) | My first CPython fix, in the json module. |
25 changes: 25 additions & 0 deletions tests/test_check_graduate.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,28 @@ def test_the_wall_shows_the_newest_first_and_says_so(tmp_path, monkeypatch):
assert page.index("zed.png") < page.index("anna.png"), "photos: newest first"
assert page.index("[@zed]") < page.index("[@anna]"), "table: newest first"
assert "The most recent is first." in wall.strip(tmp_path)


def test_a_graduate_added_again_counts_from_the_latest_addition(tmp_path):
"""Seen with #63, #67 and #68: added, removed, added again. The newest addition is what counts."""

def git(*args, when=None):
import os

env = {**os.environ, "GIT_AUTHOR_DATE": when, "GIT_COMMITTER_DATE": when} if when else None
return subprocess.run(
["git", *args], cwd=tmp_path, check=True, capture_output=True, text=True, env=env
).stdout.strip()

git("init", "-q", "-b", "main")
git("config", "user.email", "t@example.com")
git("config", "user.name", "t")
(tmp_path / "ada.py").write_text(GOOD)
git("add", ".")
git("commit", "-qm", "add", when="2026-01-01T00:00:00")
git("rm", "-q", "ada.py")
git("commit", "-qm", "remove", when="2026-01-02T00:00:00")
(tmp_path / "ada.py").write_text(GOOD)
git("add", ".")
git("commit", "-qm", "add again", when="2026-01-03T00:00:00")
assert wall.added_time(tmp_path / "ada.py") == int(git("log", "-1", "--format=%ct"))
5 changes: 3 additions & 2 deletions tools/graduates_wall.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def added_time(path: Path) -> int:
"""When the graduate's file landed on this branch, so the newest graduates come first.

``--first-parent`` follows the branch's own history, so this is the time
of the merge that brought the file in, not when the learner wrote it.
of the merge that brought the file in, not when the learner wrote it. If
the file was removed and added again, the latest addition counts.
"""
try:
out = subprocess.run(
Expand All @@ -75,7 +76,7 @@ def added_time(path: Path) -> int:
).stdout.split()
except (OSError, subprocess.SubprocessError):
return 0
return int(out[-1]) if out and out[-1].isdigit() else 0
return int(out[0]) if out and out[0].isdigit() else 0 # git log lists the newest first


def graduates(folder: Path) -> list[Graduate]:
Expand Down
Loading