From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5783815800F for ; Sat, 31 Dec 2022 11:32:37 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9E63AE0874; Sat, 31 Dec 2022 11:32:36 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 776ACE0871 for ; Sat, 31 Dec 2022 11:32:36 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6646733BEAC for ; Sat, 31 Dec 2022 11:32:35 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0AE857D0 for ; Sat, 31 Dec 2022 11:32:34 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1672486219.10717ac4ea34a89ed60d1d0d118c491102de9862.arthurzam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/pkgcheck/, dev-util/pkgcheck/files/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-util/pkgcheck/files/pkgcheck-0.10.20-fix-replay-bin.patch dev-util/pkgcheck/pkgcheck-0.10.20.ebuild X-VCS-Directories: dev-util/pkgcheck/files/ dev-util/pkgcheck/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: 10717ac4ea34a89ed60d1d0d118c491102de9862 X-VCS-Branch: master Date: Sat, 31 Dec 2022 11:32:34 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9eeea1d4-1be4-4c00-b40e-8e940f30396c X-Archives-Hash: 43f408b4a119a4ab1677aea9c02c7f6b commit: 10717ac4ea34a89ed60d1d0d118c491102de9862 Author: Arthur Zamarin gentoo org> AuthorDate: Sat Dec 31 11:30:19 2022 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Sat Dec 31 11:30:19 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10717ac4 dev-util/pkgcheck: fix missing bin/ for replay test Closes: https://bugs.gentoo.org/888896 Signed-off-by: Arthur Zamarin gentoo.org> .../files/pkgcheck-0.10.20-fix-replay-bin.patch | 109 +++++++++++++++++++++ dev-util/pkgcheck/pkgcheck-0.10.20.ebuild | 4 + 2 files changed, 113 insertions(+) diff --git a/dev-util/pkgcheck/files/pkgcheck-0.10.20-fix-replay-bin.patch b/dev-util/pkgcheck/files/pkgcheck-0.10.20-fix-replay-bin.patch new file mode 100644 index 000000000000..e20c0b3f53f5 --- /dev/null +++ b/dev-util/pkgcheck/files/pkgcheck-0.10.20-fix-replay-bin.patch @@ -0,0 +1,109 @@ +test_pkgcheck_replay: fix test_replay_pipe_stdin from sdist + +Bug: https://bugs.gentoo.org/888896 +Signed-off-by: Arthur Zamarin +--- a/tests/scripts/test_pkgcheck_replay.py ++++ b/tests/scripts/test_pkgcheck_replay.py +@@ -1,20 +1,18 @@ +-import os +-import subprocess + import tempfile + from functools import partial + from unittest.mock import patch + + import pytest ++from snakeoil.formatters import PlainTextFormatter ++ + from pkgcheck import __title__ as project + from pkgcheck.checks.profiles import ProfileWarning + from pkgcheck.reporters import JsonStream + from pkgcheck.scripts import run +-from snakeoil.formatters import PlainTextFormatter + + + class TestPkgcheckReplay: +- +- script = partial(run, project) ++ script = staticmethod(partial(run, project)) + + @pytest.fixture(autouse=True) + def _setup(self, testconfig): +@@ -33,11 +31,11 @@ class TestPkgcheckReplay: + + def test_replay(self, capsys): + result = ProfileWarning("profile warning: foo") +- with tempfile.NamedTemporaryFile() as f: +- out = PlainTextFormatter(f) ++ with tempfile.NamedTemporaryFile() as file: ++ out = PlainTextFormatter(file) + with JsonStream(out) as reporter: + reporter.report(result) +- with patch("sys.argv", self.args + ["-R", "StrReporter", f.name]): ++ with patch("sys.argv", self.args + ["-R", "StrReporter", file.name]): + with pytest.raises(SystemExit) as excinfo: + self.script() + out, err = capsys.readouterr() +@@ -47,13 +45,13 @@ class TestPkgcheckReplay: + + def test_corrupted_resuts(self, capsys): + result = ProfileWarning("profile warning: foo") +- with tempfile.NamedTemporaryFile() as f: +- out = PlainTextFormatter(f) ++ with tempfile.NamedTemporaryFile() as file: ++ out = PlainTextFormatter(file) + with JsonStream(out) as reporter: + reporter.report(result) +- f.write(b"corrupted") +- f.seek(0) +- with patch("sys.argv", self.args + ["-R", "StrReporter", f.name]): ++ file.write(b"corrupted") ++ file.seek(0) ++ with patch("sys.argv", self.args + ["-R", "StrReporter", file.name]): + with pytest.raises(SystemExit) as excinfo: + self.script() + out, err = capsys.readouterr() +@@ -61,26 +59,28 @@ class TestPkgcheckReplay: + assert excinfo.value.code == 2 + + def test_invalid_file(self, capsys): +- with tempfile.NamedTemporaryFile(mode="wt") as f: +- f.write("invalid file") +- f.seek(0) +- with patch("sys.argv", self.args + ["-R", "StrReporter", f.name]): ++ with tempfile.NamedTemporaryFile(mode="wt") as file: ++ file.write("invalid file") ++ file.seek(0) ++ with patch("sys.argv", self.args + ["-R", "StrReporter", file.name]): + with pytest.raises(SystemExit) as excinfo: + self.script() + out, err = capsys.readouterr() + assert err.strip() == "pkgcheck replay: error: invalid or unsupported replay file" + assert excinfo.value.code == 2 + +- def test_replay_pipe_stdin(self): +- script = pytest.REPO_ROOT / "bin/pkgcheck" +- result = ProfileWarning("profile warning: foo") +- with tempfile.NamedTemporaryFile() as f: +- out = PlainTextFormatter(f) ++ def test_replay_pipe_stdin(self, capsys): ++ with tempfile.NamedTemporaryFile() as file: ++ out = PlainTextFormatter(file) + with JsonStream(out) as reporter: +- reporter.report(result) +- f.seek(0) +- p = subprocess.run( +- [script, "replay", "-R", "StrReporter", "-"], stdin=f, stdout=subprocess.PIPE +- ) +- assert p.stdout.decode() == "profile warning: foo\n" +- assert p.returncode == 0 ++ reporter.report(ProfileWarning("profile warning: foo")) ++ file.seek(0) ++ ++ with open(file.name) as stdin, patch("sys.stdin", stdin), patch( ++ "sys.argv", [*self.args, "-R", "StrReporter", "-"] ++ ), pytest.raises(SystemExit) as excinfo: ++ self.script() ++ out, err = capsys.readouterr() ++ assert not err ++ assert out == "profile warning: foo\n" ++ assert excinfo.value.code == 0 diff --git a/dev-util/pkgcheck/pkgcheck-0.10.20.ebuild b/dev-util/pkgcheck/pkgcheck-0.10.20.ebuild index 45516db85496..c3d2532fb01c 100644 --- a/dev-util/pkgcheck/pkgcheck-0.10.20.ebuild +++ b/dev-util/pkgcheck/pkgcheck-0.10.20.ebuild @@ -55,6 +55,10 @@ BDEPEND="${RDEPEND} ) " +PATCHES=( + "${FILESDIR}/${P}-fix-replay-bin.patch" +) + SITEFILE="50${PN}-gentoo.el" distutils_enable_tests pytest