12
12
import pathlib
13
13
import pickle
14
14
import tempfile
15
- from unittest import skipIf , SkipTest
15
+ from unittest import mock , skipIf , SkipTest
16
16
17
17
from git import (
18
18
InvalidGitRepositoryError ,
37
37
)
38
38
from git .repo .fun import touch
39
39
from git .test .lib import (
40
- patch ,
41
40
TestBase ,
42
41
with_rw_repo ,
43
42
fixture
@@ -393,7 +392,7 @@ def test_archive(self):
393
392
assert stream .tell ()
394
393
os .remove (tmpfile )
395
394
396
- @patch .object (Git , '_call_process' )
395
+ @mock . patch .object (Git , '_call_process' )
397
396
def test_should_display_blame_information (self , git ):
398
397
git .return_value = fixture ('blame' )
399
398
b = self .rorepo .blame ('master' , 'lib/git.py' )
@@ -437,7 +436,7 @@ def test_blame_real(self):
437
436
assert c , "Should have executed at least one blame command"
438
437
assert nml , "There should at least be one blame commit that contains multiple lines"
439
438
440
- @patch .object (Git , '_call_process' )
439
+ @mock . patch .object (Git , '_call_process' )
441
440
def test_blame_incremental (self , git ):
442
441
# loop over two fixtures, create a test fixture for 2.11.1+ syntax
443
442
for git_fixture in ('blame_incremental' , 'blame_incremental_2.11.1_plus' ):
@@ -460,7 +459,7 @@ def test_blame_incremental(self, git):
460
459
orig_ranges = flatten ([entry .orig_linenos for entry in blame_output ])
461
460
self .assertEqual (orig_ranges , flatten ([range (2 , 3 ), range (14 , 15 ), range (1 , 2 ), range (2 , 13 ), range (13 , 15 )])) # noqa E501
462
461
463
- @patch .object (Git , '_call_process' )
462
+ @mock . patch .object (Git , '_call_process' )
464
463
def test_blame_complex_revision (self , git ):
465
464
git .return_value = fixture ('blame_complex_revision' )
466
465
res = self .rorepo .blame ("HEAD~10..HEAD" , "README.md" )
0 commit comments