import mock
import os

from dvc import dagascii
from dvc.env import DVC_PAGER


def test_less_pager_returned_when_less_found():
    with mock.patch.object(os, "system") as m:
        m.return_value = 0
        pager = dagascii.find_pager()

    assert pager.cmd == dagascii.DEFAULT_PAGER_FORMATTED


def test_plainpager_returned_when_less_missing():
    with mock.patch.object(os, "system") as m:
        m.return_value = 1  # any non-zero value
        pager = dagascii.find_pager()

    assert pager.__name__ == "plainpager"


def test_tempfilepager_returned_when_var_defined():
    os.environ[DVC_PAGER] = dagascii.DEFAULT_PAGER
    pager = dagascii.find_pager()

    assert pager.cmd == dagascii.DEFAULT_PAGER

@@ -118,32 +118,35 @@
 s_found(
+mocker
 ):%0A    
-with 
 mock
+er
 .patch.o
@@ -163,34 +163,18 @@
 %22system%22
-) as m:%0A        m.
+, 
 return_v
@@ -181,17 +181,13 @@
 alue
- = 0%0A    
+=0)%0A%0A
     
@@ -327,24 +327,27 @@
 ing(
+mocker
 ):%0A    
-with 
 mock
+er
 .pat
@@ -372,69 +372,27 @@
 tem%22
-) as m:%0A        m.return_value = 1  # any non-zero value%0A    
+, return_value=1)%0A%0A
     
@@ -515,23 +515,47 @@
 defined(
+mocker
 ):%0A    
+mocker.patch.dict(
 os.envir
@@ -560,9 +560,12 @@
 iron
-%5B
+, %7B%22
 DVC_
@@ -573,11 +573,10 @@
 AGER
-%5D =
+%22:
  dag
@@ -594,16 +594,18 @@
 LT_PAGER
+%7D)
 %0A    pag

Use mocker fixture in test_dagascii.py