diff --git a/generate_release.py b/generate_release.py index 2c6ba62..0bb818e 100644 --- a/generate_release.py +++ b/generate_release.py @@ -19,11 +19,6 @@ def generate_release(): if Repo().is_dirty(): error("repo is dirty (stash changes before generating a release)") - with patch.object(sys, "argv", ["", "-q"]): - info("running pytest ...") - if (exit_code := pytest()) != 0: - error(f"tests failed with {exit_code}") - if Repo().head.is_detached: error("repo is in detached head state") if "up to date" not in Repo().git.status(): @@ -31,6 +26,11 @@ def generate_release(): if Repo().tags[-1].commit != Repo().commit(): error("current commit is not tagged") + with patch.object(sys, "argv", ["", "-q"]): + info("running pytest ...") + if (exit_code := pytest()) != 0: + error(f"tests failed with {exit_code}") + info(f"generating release for {Repo().tags[-1]} ... ") ARCHIVE_DIRECTORY.mkdir(exist_ok=True)