5
5
6
6
import pytest
7
7
8
- from pip ._internal .exceptions import BadCommand , InstallationError
9
- from pip ._internal .utils .misc import hide_url , hide_value
10
- from pip ._internal .vcs import make_vcs_requirement_url
11
- from pip ._internal .vcs .bazaar import Bazaar
12
- from pip ._internal .vcs .git import Git , RemoteNotValidError , looks_like_hash
13
- from pip ._internal .vcs .mercurial import Mercurial
14
- from pip ._internal .vcs .subversion import Subversion
15
- from pip ._internal .vcs .versioncontrol import RevOptions , VersionControl
8
+ from fetchcode . vcs . pip ._internal .exceptions import BadCommand , InstallationError
9
+ from fetchcode . vcs . pip ._internal .utils .misc import hide_url , hide_value
10
+ from fetchcode . vcs . pip ._internal .vcs import make_vcs_requirement_url
11
+ from fetchcode . vcs . pip ._internal .vcs .bazaar import Bazaar
12
+ from fetchcode . vcs . pip ._internal .vcs .git import Git , RemoteNotValidError , looks_like_hash
13
+ from fetchcode . vcs . pip ._internal .vcs .mercurial import Mercurial
14
+ from fetchcode . vcs . pip ._internal .vcs .subversion import Subversion
15
+ from fetchcode . vcs . pip ._internal .vcs .versioncontrol import RevOptions , VersionControl
16
16
from tests .lib import is_svn_installed , need_svn
17
17
18
18
@@ -153,7 +153,7 @@ def test_git_remote_url_to_pip(url, target):
153
153
def test_paths_are_not_mistaken_for_scp_shorthand (url , platform ):
154
154
# File paths should not be mistaken for SCP shorthand. If they do then
155
155
# 'c:/piffle/wiffle' would end up as 'ssh://c/piffle/wiffle'.
156
- from pip ._internal .vcs .git import SCP_REGEX
156
+ from fetchcode . vcs . pip ._internal .vcs .git import SCP_REGEX
157
157
assert not SCP_REGEX .match (url )
158
158
159
159
if platform == os .name :
@@ -168,9 +168,9 @@ def test_git_remote_local_path(tmpdir):
168
168
assert Git ._git_remote_to_pip_url (str (path )) == path .as_uri ()
169
169
170
170
171
- @patch ('pip._internal.vcs.git.Git.get_remote_url' )
172
- @patch ('pip._internal.vcs.git.Git.get_revision' )
173
- @patch ('pip._internal.vcs.git.Git.get_subdirectory' )
171
+ @patch ('fetchcode.vcs. pip._internal.vcs.git.Git.get_remote_url' )
172
+ @patch ('fetchcode.vcs. pip._internal.vcs.git.Git.get_revision' )
173
+ @patch ('fetchcode.vcs. pip._internal.vcs.git.Git.get_subdirectory' )
174
174
@pytest .mark .parametrize (
175
175
"git_url, target_url_prefix" ,
176
176
[
@@ -202,7 +202,7 @@ def test_git_get_src_requirements(
202
202
assert ret == target
203
203
204
204
205
- @patch ('pip._internal.vcs.git.Git.get_revision_sha' )
205
+ @patch ('fetchcode.vcs. pip._internal.vcs.git.Git.get_revision_sha' )
206
206
def test_git_resolve_revision_rev_exists (get_sha_mock ):
207
207
get_sha_mock .return_value = ('123456' , False )
208
208
url = 'git+https://git.example.com'
@@ -212,7 +212,7 @@ def test_git_resolve_revision_rev_exists(get_sha_mock):
212
212
assert new_options .rev == '123456'
213
213
214
214
215
- @patch ('pip._internal.vcs.git.Git.get_revision_sha' )
215
+ @patch ('fetchcode.vcs. pip._internal.vcs.git.Git.get_revision_sha' )
216
216
def test_git_resolve_revision_rev_not_found (get_sha_mock ):
217
217
get_sha_mock .return_value = (None , False )
218
218
url = 'git+https://git.example.com'
@@ -222,7 +222,7 @@ def test_git_resolve_revision_rev_not_found(get_sha_mock):
222
222
assert new_options .rev == 'develop'
223
223
224
224
225
- @patch ('pip._internal.vcs.git.Git.get_revision_sha' )
225
+ @patch ('fetchcode.vcs. pip._internal.vcs.git.Git.get_revision_sha' )
226
226
def test_git_resolve_revision_not_found_warning (get_sha_mock , caplog ):
227
227
get_sha_mock .return_value = (None , False )
228
228
url = 'git+https://git.example.com'
@@ -253,7 +253,7 @@ def test_git_resolve_revision_not_found_warning(get_sha_mock, caplog):
253
253
('foo' , False ),
254
254
(None , False ),
255
255
))
256
- @patch ('pip._internal.vcs.git.Git.get_revision' )
256
+ @patch ('fetchcode.vcs. pip._internal.vcs.git.Git.get_revision' )
257
257
def test_git_is_commit_id_equal (mock_get_revision , rev_name , result ):
258
258
"""
259
259
Test Git.is_commit_id_equal().
@@ -379,7 +379,7 @@ def test_version_control__run_command__fails(vcs_cls, exc_cls, msg_re):
379
379
when the command is not found or when the user have no permission
380
380
to execute it. The error message must contains the command name.
381
381
"""
382
- with patch ("pip._internal.vcs.versioncontrol.call_subprocess" ) as call :
382
+ with patch ("fetchcode.vcs. pip._internal.vcs.versioncontrol.call_subprocess" ) as call :
383
383
call .side_effect = exc_cls
384
384
with pytest .raises (BadCommand , match = msg_re .format (name = vcs_cls .name )):
385
385
vcs_cls .run_command ([])
@@ -533,7 +533,7 @@ def test_subversion__call_vcs_version():
533
533
('svn, version . .' , ()),
534
534
('' , ()),
535
535
])
536
- @patch ('pip._internal.vcs.subversion.Subversion.run_command' )
536
+ @patch ('fetchcode.vcs. pip._internal.vcs.subversion.Subversion.run_command' )
537
537
def test_subversion__call_vcs_version_patched (
538
538
mock_run_command , svn_output , expected_version ):
539
539
"""
@@ -544,7 +544,7 @@ def test_subversion__call_vcs_version_patched(
544
544
assert version == expected_version
545
545
546
546
547
- @patch ('pip._internal.vcs.subversion.Subversion.run_command' )
547
+ @patch ('fetchcode.vcs. pip._internal.vcs.subversion.Subversion.run_command' )
548
548
def test_subversion__call_vcs_version_svn_not_installed (mock_run_command ):
549
549
"""
550
550
Test Subversion.call_vcs_version() when svn is not installed.
@@ -574,7 +574,7 @@ def test_subversion__get_vcs_version_cached(version):
574
574
(1 , 7 ),
575
575
(1 , 8 , 0 ),
576
576
])
577
- @patch ('pip._internal.vcs.subversion.Subversion.call_vcs_version' )
577
+ @patch ('fetchcode.vcs. pip._internal.vcs.subversion.Subversion.call_vcs_version' )
578
578
def test_subversion__get_vcs_version_call_vcs (mock_call_vcs , vcs_version ):
579
579
"""
580
580
Test Subversion.get_vcs_version() with mocked output from
@@ -608,7 +608,7 @@ def test_subversion__get_remote_call_options(
608
608
609
609
class TestSubversionArgs (TestCase ):
610
610
def setUp (self ):
611
- patcher = patch ('pip._internal.vcs.versioncontrol.call_subprocess' )
611
+ patcher = patch ('fetchcode.vcs. pip._internal.vcs.versioncontrol.call_subprocess' )
612
612
self .addCleanup (patcher .stop )
613
613
self .call_subprocess_mock = patcher .start ()
614
614
0 commit comments