commit:     2c092ede25d5a926be067fbf53f5b3c17143f965
Author:     Yixun Lan <dlan <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 30 01:27:33 2021 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Thu Sep 30 01:27:33 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c092ede

dev-vcs/git-pw: fix tests error

Thanks Matt Smith for contribution

Closes: https://bugs.gentoo.org/815031
Package-Manager: Portage-3.0.23, Repoman-3.0.3
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 dev-vcs/git-pw/files/git-pw-2.1.1-test.patch | 28 ++++++++++++++++++++++++++++
 dev-vcs/git-pw/git-pw-2.1.1.ebuild           |  2 ++
 2 files changed, 30 insertions(+)

diff --git a/dev-vcs/git-pw/files/git-pw-2.1.1-test.patch 
b/dev-vcs/git-pw/files/git-pw-2.1.1-test.patch
new file mode 100644
index 00000000000..00df55f872d
--- /dev/null
+++ b/dev-vcs/git-pw/files/git-pw-2.1.1-test.patch
@@ -0,0 +1,28 @@
+From 08152c86d02c36c425047fa9220d6d5ac3fcda01 Mon Sep 17 00:00:00 2001
+From: Matt Smith <[email protected]>
+Date: Sun, 26 Sep 2021 19:55:40 +0100
+Subject: [PATCH] tests: Unset PAGER env when testing fallback
+
+Prior to this commit, the test test_echo_via_pager_env_default will
+fail when $PAGER is set to /usr/bin/less (or anything other than
+"less").  Use unittest.mock to unset the environment variable during
+the test.
+---
+ tests/test_utils.py | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tests/test_utils.py b/tests/test_utils.py
+index cf75a55..a0974f1 100644
+--- a/tests/test_utils.py
++++ b/tests/test_utils.py
+@@ -75,6 +75,7 @@ def test_echo_via_pager_env_PAGER(mock_inner, mock_tabulate, 
mock_config):
+ @mock.patch.object(utils, 'git_config', return_value=None)
+ @mock.patch.object(utils, '_tabulate')
+ @mock.patch.object(utils, '_echo_via_pager')
[email protected](os.environ, {'PAGER': ''})
+ def test_echo_via_pager_env_default(mock_inner, mock_tabulate, mock_config):
+     utils.echo_via_pager('test', ('foo',), None)
+ 
+-- 
+2.33.0
+

diff --git a/dev-vcs/git-pw/git-pw-2.1.1.ebuild 
b/dev-vcs/git-pw/git-pw-2.1.1.ebuild
index a27a91f9a2c..dd63e27b733 100644
--- a/dev-vcs/git-pw/git-pw-2.1.1.ebuild
+++ b/dev-vcs/git-pw/git-pw-2.1.1.ebuild
@@ -21,6 +21,8 @@ LICENSE="MIT"
 SLOT="0"
 IUSE=""
 
+PATCHES=( "${FILESDIR}/${P}-test.patch" )
+
 RDEPEND="
        >=dev-python/arrow-0.10[${PYTHON_USEDEP}]
        <dev-python/click-8.0[${PYTHON_USEDEP}]

Reply via email to