def test_gather(directory): fixes = directory / "2 Fixes" fixes.mkdir() fix1 = fixes / "1.md" fix1.write_text("Fix 1", encoding="utf-8") fix2 = fixes / "3.md" fix2.write_text("Fix 2", encoding="utf-8") enhancements = directory / "1 Enhancements" enhancements.mkdir() enhancement1 = enhancements / "2.md" enhancement1.write_text("Enhancement 1", encoding="utf-8") enhancement2 = enhancements / "4.md" enhancement2.write_text("Enhancement 2", encoding="utf-8") results = ann.gather(directory) assert len(results) == 2 section, entries = results[0] assert section.title == "Enhancements" assert len(entries) == 2 assert entries[0].description == "Enhancement 1" assert entries[1].description == "Enhancement 2" section, entries = results[1] assert len(entries) == 2 assert section.title == "Fixes" assert entries[0].description == "Fix 1" assert entries[1].description == "Fix 2"
def test_gather(directory): fixes = directory / '2 Fixes' fixes.mkdir() fix1 = fixes / '1.md' fix1.write_text('Fix 1', encoding='utf-8') fix2 = fixes / '3.md' fix2.write_text('Fix 2', encoding='utf-8') enhancements = directory / '1 Enhancements' enhancements.mkdir() enhancement1 = enhancements / '2.md' enhancement1.write_text('Enhancement 1', encoding='utf-8') enhancement2 = enhancements / '4.md' enhancement2.write_text('Enhancement 2', encoding='utf-8') results = ann.gather(directory) assert len(results) == 2 section, entries = results[0] assert section.title == 'Enhancements' assert len(entries) == 2 assert entries[0].description == 'Enhancement 1' assert entries[1].description == 'Enhancement 2' section, entries = results[1] assert len(entries) == 2 assert section.title == 'Fixes' assert entries[0].description == 'Fix 1' assert entries[1].description == 'Fix 2'
def test_cleanup(directory, monkeypatch): rm_path = None def fake_git_rm(path): nonlocal rm_path rm_path = path monkeypatch.setattr(ann, 'git_rm', fake_git_rm) fixes = directory / '2 Fixes' fixes.mkdir() fix1 = fixes / '1.md' fix1.write_text('Fix 1', encoding='utf-8') results = ann.gather(directory) assert len(results) == 1 ann.cleanup(results) section, entries = results.pop() assert len(entries) == 1 assert rm_path == entries[0].path
def test_cleanup(directory, monkeypatch): rm_path = None def fake_git_rm(path): nonlocal rm_path rm_path = path monkeypatch.setattr(ann, "git_rm", fake_git_rm) fixes = directory / "2 Fixes" fixes.mkdir() fix1 = fixes / "1.md" fix1.write_text("Fix 1", encoding="utf-8") results = ann.gather(directory) assert len(results) == 1 ann.cleanup(results) section, entries = results.pop() assert len(entries) == 1 assert rm_path == entries[0].path