You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tooling.apache.org by sb...@apache.org on 2026/09/17 15:58:09 UTC
(tooling-trusted-releases) branch sbp updated: Allow empty drafts in validation
This is an automated email from the ASF dual-hosted git repository.
sbp pushed a commit to branch sbp
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/sbp by this push:
new 3b68f658 Allow empty drafts in validation
3b68f658 is described below
commit 3b68f6586344cea94a37c9d88db739dad54d1cf1
Author: Sean B. Palmer <se...@miscoranda.com>
AuthorDate: Thu Sep 17 16:57:43 2026 +0100
Allow empty drafts in validation
---
atr/validate.py | 4 ++++
tests/unit/test_validate_on_disk.py | 31 +++++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/atr/validate.py b/atr/validate.py
index a6e64327..df472665 100644
--- a/atr/validate.py
+++ b/atr/validate.py
@@ -458,6 +458,10 @@ def release_on_disk(r: sql.Release) -> Divergences:
yield from divergences_predicate(lambda p: not p.path.exists(), expected, unfinished)
return
path = paths.release_directory(r)
+ if r.phase == sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT:
+ expected = "directory to exist"
+ yield from divergences_predicate(lambda p: p.path.is_dir(), expected, path)
+ return
def okay(p: safe.StatePath) -> bool:
# The release directory must exist and contain at least one entry
diff --git a/tests/unit/test_validate_on_disk.py b/tests/unit/test_validate_on_disk.py
index 7647feef..e7b422bd 100644
--- a/tests/unit/test_validate_on_disk.py
+++ b/tests/unit/test_validate_on_disk.py
@@ -55,6 +55,37 @@ def release(phase: sql.ReleasePhase) -> mock.MagicMock:
return result
+@pytest.mark.parametrize("embargoed", [False, True])
+@pytest.mark.parametrize(
+ ("phase", "expected_divergences"),
+ [
+ (sql.ReleasePhase.RELEASE_CANDIDATE_DRAFT, 0),
+ (sql.ReleasePhase.RELEASE_CANDIDATE, 1),
+ (sql.ReleasePhase.RELEASE_PREVIEW, 1),
+ ],
+)
+def test_release_on_disk_empty_revision(
+ tmp_path: pathlib.Path,
+ monkeypatch: pytest.MonkeyPatch,
+ embargoed: bool,
+ phase: sql.ReleasePhase,
+ expected_divergences: int,
+) -> None:
+ unfinished = safe.StatePath(tmp_path / "unfinished")
+ private = safe.StatePath(tmp_path / "embargoed")
+ monkeypatch.setattr(validate.paths, "get_unfinished_dir", lambda: unfinished)
+ monkeypatch.setattr(validate.paths, "get_embargoed_dir", lambda: private)
+ root = private if embargoed else unfinished
+ (root.path / "proj" / "1.0" / "00001").mkdir(parents=True)
+ release_mock = release(phase)
+ release_mock.is_embargoed = embargoed
+ release_mock.latest_revision_number = "00001"
+
+ divergences = list(validate.release_on_disk(release_mock))
+
+ assert len(divergences) == expected_divergences
+
+
def test_release_on_disk_flags_lingering_unfinished_directory(
tmp_path: pathlib.Path, monkeypatch: pytest.MonkeyPatch
) -> None:
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@tooling.apache.org
For additional commands, e-mail: commits-help@tooling.apache.org