Skip to content

Commit fb8f67c

Browse files
00-mattstephenfin
authored andcommitted
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.
1 parent 381b535 commit fb8f67c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tests/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def test_echo_via_pager_env_PAGER(mock_inner, mock_tabulate, mock_config):
7575
@mock.patch.object(utils, 'git_config', return_value=None)
7676
@mock.patch.object(utils, '_tabulate')
7777
@mock.patch.object(utils, '_echo_via_pager')
78+
@mock.patch.dict(os.environ, {'PAGER': ''})
7879
def test_echo_via_pager_env_default(mock_inner, mock_tabulate, mock_config):
7980
utils.echo_via_pager('test', ('foo',), None)
8081

0 commit comments

Comments
 (0)