Skip to content

Commit a998135

Browse files
committed
Fix imports in tests
find tests -type f -name '*.py' \ -exec sed -i 's/from\ pip._/from\ fetchcode.vcs.pip._/g' {} + \ -exec sed -i 's/import\ pip._/import\ fetchcode.vcs.pip._/g' {} + \ -exec sed -i 's/"pip._/"fetchcode.vcs.pip._/g' {} + \ -exec sed -i "s/'pip._/'fetchcode.vcs.pip._/g" {} + Signed-off-by: Alexander Mazuruk <a.mazuruk@samsung.com>
1 parent 564f6fb commit a998135

9 files changed

+44
-44
lines changed

tests/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
import pytest
1515
from setuptools.wheel import Wheel
1616

17-
from pip._internal.cli.main import main as pip_entry_point
18-
from pip._internal.utils.temp_dir import global_tempdir_manager
17+
from fetchcode.vcs.pip._internal.cli.main import main as pip_entry_point
18+
from fetchcode.vcs.pip._internal.utils.temp_dir import global_tempdir_manager
1919
from tests.lib import DATA_DIR, SRC_DIR, PipTestEnvironment, TestData
2020
from tests.lib.certs import make_tls_cert, serialize_cert, serialize_key
2121
from tests.lib.path import Path

tests/lib/__init__.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@
1515
from zipfile import ZipFile
1616

1717
import pytest
18-
from pip._vendor.packaging.utils import canonicalize_name
18+
from fetchcode.vcs.pip._vendor.packaging.utils import canonicalize_name
1919
from scripttest import FoundDir, TestFileEnvironment
2020

21-
from pip._internal.index.collector import LinkCollector
22-
from pip._internal.index.package_finder import PackageFinder
23-
from pip._internal.locations import get_major_minor_version
24-
from pip._internal.models.search_scope import SearchScope
25-
from pip._internal.models.selection_prefs import SelectionPreferences
26-
from pip._internal.models.target_python import TargetPython
27-
from pip._internal.network.session import PipSession
28-
from pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX
21+
from fetchcode.vcs.pip._internal.index.collector import LinkCollector
22+
from fetchcode.vcs.pip._internal.index.package_finder import PackageFinder
23+
from fetchcode.vcs.pip._internal.locations import get_major_minor_version
24+
from fetchcode.vcs.pip._internal.models.search_scope import SearchScope
25+
from fetchcode.vcs.pip._internal.models.selection_prefs import SelectionPreferences
26+
from fetchcode.vcs.pip._internal.models.target_python import TargetPython
27+
from fetchcode.vcs.pip._internal.network.session import PipSession
28+
from fetchcode.vcs.pip._internal.utils.deprecation import DEPRECATION_MSG_PREFIX
2929
from tests.lib.path import Path, curdir
3030
from tests.lib.wheel import make_wheel
3131

@@ -70,7 +70,7 @@ def _test_path_to_file_url(path):
7070

7171
def create_file(path, contents=None):
7272
"""Create a file on the path, with the given contents"""
73-
from pip._internal.utils.misc import ensure_dir
73+
from fetchcode.vcs.pip._internal.utils.misc import ensure_dir
7474

7575
ensure_dir(os.path.dirname(path))
7676
with open(path, "w") as f:

tests/lib/local_repos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
import subprocess
33
import urllib.request
44

5-
from pip._internal.utils.misc import hide_url
6-
from pip._internal.vcs import vcs
5+
from fetchcode.vcs.pip._internal.utils.misc import hide_url
6+
from fetchcode.vcs.pip._internal.vcs import vcs
77
from tests.lib import path_to_url
88
from tests.lib.path import Path
99

tests/test_vcs_pip.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55

66
import pytest
77

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
1616
from tests.lib import is_svn_installed, need_svn
1717

1818

@@ -153,7 +153,7 @@ def test_git_remote_url_to_pip(url, target):
153153
def test_paths_are_not_mistaken_for_scp_shorthand(url, platform):
154154
# File paths should not be mistaken for SCP shorthand. If they do then
155155
# '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
157157
assert not SCP_REGEX.match(url)
158158

159159
if platform == os.name:
@@ -168,9 +168,9 @@ def test_git_remote_local_path(tmpdir):
168168
assert Git._git_remote_to_pip_url(str(path)) == path.as_uri()
169169

170170

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')
174174
@pytest.mark.parametrize(
175175
"git_url, target_url_prefix",
176176
[
@@ -202,7 +202,7 @@ def test_git_get_src_requirements(
202202
assert ret == target
203203

204204

205-
@patch('pip._internal.vcs.git.Git.get_revision_sha')
205+
@patch('fetchcode.vcs.pip._internal.vcs.git.Git.get_revision_sha')
206206
def test_git_resolve_revision_rev_exists(get_sha_mock):
207207
get_sha_mock.return_value = ('123456', False)
208208
url = 'git+https://git.example.com'
@@ -212,7 +212,7 @@ def test_git_resolve_revision_rev_exists(get_sha_mock):
212212
assert new_options.rev == '123456'
213213

214214

215-
@patch('pip._internal.vcs.git.Git.get_revision_sha')
215+
@patch('fetchcode.vcs.pip._internal.vcs.git.Git.get_revision_sha')
216216
def test_git_resolve_revision_rev_not_found(get_sha_mock):
217217
get_sha_mock.return_value = (None, False)
218218
url = 'git+https://git.example.com'
@@ -222,7 +222,7 @@ def test_git_resolve_revision_rev_not_found(get_sha_mock):
222222
assert new_options.rev == 'develop'
223223

224224

225-
@patch('pip._internal.vcs.git.Git.get_revision_sha')
225+
@patch('fetchcode.vcs.pip._internal.vcs.git.Git.get_revision_sha')
226226
def test_git_resolve_revision_not_found_warning(get_sha_mock, caplog):
227227
get_sha_mock.return_value = (None, False)
228228
url = 'git+https://git.example.com'
@@ -253,7 +253,7 @@ def test_git_resolve_revision_not_found_warning(get_sha_mock, caplog):
253253
('foo', False),
254254
(None, False),
255255
))
256-
@patch('pip._internal.vcs.git.Git.get_revision')
256+
@patch('fetchcode.vcs.pip._internal.vcs.git.Git.get_revision')
257257
def test_git_is_commit_id_equal(mock_get_revision, rev_name, result):
258258
"""
259259
Test Git.is_commit_id_equal().
@@ -379,7 +379,7 @@ def test_version_control__run_command__fails(vcs_cls, exc_cls, msg_re):
379379
when the command is not found or when the user have no permission
380380
to execute it. The error message must contains the command name.
381381
"""
382-
with patch("pip._internal.vcs.versioncontrol.call_subprocess") as call:
382+
with patch("fetchcode.vcs.pip._internal.vcs.versioncontrol.call_subprocess") as call:
383383
call.side_effect = exc_cls
384384
with pytest.raises(BadCommand, match=msg_re.format(name=vcs_cls.name)):
385385
vcs_cls.run_command([])
@@ -533,7 +533,7 @@ def test_subversion__call_vcs_version():
533533
('svn, version . .', ()),
534534
('', ()),
535535
])
536-
@patch('pip._internal.vcs.subversion.Subversion.run_command')
536+
@patch('fetchcode.vcs.pip._internal.vcs.subversion.Subversion.run_command')
537537
def test_subversion__call_vcs_version_patched(
538538
mock_run_command, svn_output, expected_version):
539539
"""
@@ -544,7 +544,7 @@ def test_subversion__call_vcs_version_patched(
544544
assert version == expected_version
545545

546546

547-
@patch('pip._internal.vcs.subversion.Subversion.run_command')
547+
@patch('fetchcode.vcs.pip._internal.vcs.subversion.Subversion.run_command')
548548
def test_subversion__call_vcs_version_svn_not_installed(mock_run_command):
549549
"""
550550
Test Subversion.call_vcs_version() when svn is not installed.
@@ -574,7 +574,7 @@ def test_subversion__get_vcs_version_cached(version):
574574
(1, 7),
575575
(1, 8, 0),
576576
])
577-
@patch('pip._internal.vcs.subversion.Subversion.call_vcs_version')
577+
@patch('fetchcode.vcs.pip._internal.vcs.subversion.Subversion.call_vcs_version')
578578
def test_subversion__get_vcs_version_call_vcs(mock_call_vcs, vcs_version):
579579
"""
580580
Test Subversion.get_vcs_version() with mocked output from
@@ -608,7 +608,7 @@ def test_subversion__get_remote_call_options(
608608

609609
class TestSubversionArgs(TestCase):
610610
def setUp(self):
611-
patcher = patch('pip._internal.vcs.versioncontrol.call_subprocess')
611+
patcher = patch('fetchcode.vcs.pip._internal.vcs.versioncontrol.call_subprocess')
612612
self.addCleanup(patcher.stop)
613613
self.call_subprocess_mock = patcher.start()
614614

tests/test_vcs_pip_bazaar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import pytest
88

9-
from pip._internal.vcs.bazaar import Bazaar
10-
from pip._internal.vcs.versioncontrol import RemoteNotFoundError
9+
from fetchcode.vcs.pip._internal.vcs.bazaar import Bazaar
10+
from fetchcode.vcs.pip._internal.vcs.versioncontrol import RemoteNotFoundError
1111
from tests.lib import is_bzr_installed, need_bzr
1212

1313

tests/test_vcs_pip_git.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import pytest
88

9-
from pip._internal.vcs import vcs
10-
from pip._internal.vcs.git import Git, RemoteNotFoundError
9+
from fetchcode.vcs.pip._internal.vcs import vcs
10+
from fetchcode.vcs.pip._internal.vcs.git import Git, RemoteNotFoundError
1111
from tests.lib import _create_test_package, _git_commit, _test_path_to_file_url
1212

1313

tests/test_vcs_pip_mercurial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import os
22

3-
from pip._internal.vcs.mercurial import Mercurial
3+
from fetchcode.vcs.pip._internal.vcs.mercurial import Mercurial
44
from tests.lib import _create_test_package, need_mercurial
55

66

tests/test_vcs_pip_mercurial_unit.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import configparser
66
import os
77

8-
from pip._internal.utils.misc import hide_url
9-
from pip._internal.vcs.mercurial import Mercurial
8+
from fetchcode.vcs.pip._internal.utils.misc import hide_url
9+
from fetchcode.vcs.pip._internal.vcs.mercurial import Mercurial
1010
from tests.lib import need_mercurial
1111

1212

tests/test_vcs_pip_subversion.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import pytest
22

3-
from pip._internal.vcs.subversion import Subversion
4-
from pip._internal.vcs.versioncontrol import RemoteNotFoundError
3+
from fetchcode.vcs.pip._internal.vcs.subversion import Subversion
4+
from fetchcode.vcs.pip._internal.vcs.versioncontrol import RemoteNotFoundError
55
from tests.lib import _create_svn_repo, need_svn
66

77

0 commit comments

Comments
 (0)