diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2023-08-24 20:25:48 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2023-08-24 20:48:51 +0300 |
commit | 047ac2bdcfe019107b13646825818a0bc5339b9d (patch) | |
tree | 3ae0ec47c9c59a14e076df02f6194ad33b9d0793 /tests | |
parent | commit: add support to enable/disable gpg signing (diff) | |
download | pkgdev-047ac2bdcfe019107b13646825818a0bc5339b9d.tar.gz pkgdev-047ac2bdcfe019107b13646825818a0bc5339b9d.tar.bz2 pkgdev-047ac2bdcfe019107b13646825818a0bc5339b9d.zip |
push: `--ask` stops for confirmation on warnings
Resolves: https://github.com/pkgcore/pkgdev/issues/150
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scripts/test_pkgdev_push.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/scripts/test_pkgdev_push.py b/tests/scripts/test_pkgdev_push.py index f1f0a0b..fb4faa3 100644 --- a/tests/scripts/test_pkgdev_push.py +++ b/tests/scripts/test_pkgdev_push.py @@ -124,3 +124,26 @@ class TestPkgdevPush: ), pytest.raises(SystemExit) as excinfo, chdir(self.child_git_repo.path): self.script() assert excinfo.value.code == 0 + + def test_warnings(self, capsys): + pkgdir = os.path.dirname(self.child_repo.create_ebuild("cat/pkg-1")) + os.makedirs((filesdir := pjoin(pkgdir, "files")), exist_ok=True) + with open(pjoin(filesdir, "foo"), "w") as f: + f.write("") + self.child_git_repo.add_all("cat/pkg-1") + + # scans with warnings ask for confirmation before pushing with "--ask" + with patch("sys.argv", self.args + ["--ask"]), patch( + "sys.stdin", StringIO("n\n") + ), pytest.raises(SystemExit) as excinfo, chdir(self.child_git_repo.path): + self.script() + assert excinfo.value.code == 1 + out, err = capsys.readouterr() + assert "EmptyFile" in out + + # but without "--ask" it still pushes + with patch("sys.argv", self.args), pytest.raises(SystemExit) as excinfo, chdir( + self.child_git_repo.path + ): + self.script() + assert excinfo.value.code == 0 |