Skip to content

Commit 1d2fc8a

Browse files
committed
chore: Remove references to old shortcuts module
1 parent 9c064be commit 1d2fc8a

5 files changed

Lines changed: 3 additions & 61 deletions

File tree

libvcs/_internal/shortcuts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def create_project(
5757
5858
Examples
5959
--------
60-
>>> from libvcs.shortcuts import create_project
60+
>>> from libvcs._internal.shortcuts import create_project
6161
>>> r = create_project(
6262
... url=f'file://{create_git_remote_repo()}',
6363
... vcs='git',

libvcs/exc.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,5 @@ class CommandTimeoutError(CommandError):
3333
"""CommandError which gets raised when a subprocess exceeds its timeout."""
3434

3535

36-
class InvalidPipURL(LibVCSException):
37-
"""Invalid pip-style URL."""
38-
39-
def __init__(self, url):
40-
self.url = url
41-
super().__init__()
42-
43-
def __str__(self):
44-
return self.message
45-
46-
message = (
47-
"Repo URL %s requires a vcs scheme. Prepend the vcs (hg+, git+, svn+)"
48-
"to the repo URL. e.g: git+https://github.com/freebsd/freebsd.git"
49-
)
50-
51-
5236
class InvalidVCS(LibVCSException):
5337
"""Invalid VCS."""

tests/projects/test_git.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from libvcs import exc
1313
from libvcs._internal.run import run, which
14+
from libvcs._internal.shortcuts import create_project
1415
from libvcs.conftest import CreateProjectCallbackFixtureProtocol
1516
from libvcs.projects.git import (
1617
GitFullRemoteDict,
@@ -19,7 +20,6 @@
1920
GitStatus,
2021
convert_pip_url as git_convert_pip_url,
2122
)
22-
from libvcs.shortcuts import create_project
2323

2424
if not which("git"):
2525
pytestmark = pytest.mark.skip(reason="git is not available")

tests/test_exc.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,3 @@ def test_command_error():
3131
command = "command arg"
3232
raise exc.CommandError("this is output", 0, command)
3333
assert e.value.cmd == command
34-
35-
36-
def test_invalid_pip_url():
37-
with pytest.raises(exc.InvalidPipURL) as e:
38-
raise exc.InvalidPipURL("http://github.com/wrong/format")
39-
assert str(e.value) == e.value.message

tests/test_shortcuts.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,43 +4,7 @@
44

55
from libvcs import GitProject, MercurialProject, SubversionProject
66
from libvcs._internal.shortcuts import create_project
7-
from libvcs.exc import InvalidPipURL, InvalidVCS
8-
from libvcs.shortcuts import create_project_from_pip_url
9-
10-
11-
@pytest.mark.parametrize(
12-
"repo_dict,repo_class,raises_exception",
13-
[
14-
({"pip_url": "git+https://github.com/freebsd/freebsd.git"}, GitProject, False),
15-
(
16-
{"pip_url": "hg+https://bitbucket.org/birkenfeld/sphinx"},
17-
MercurialProject,
18-
False,
19-
),
20-
(
21-
{"pip_url": "svn+http://svn.code.sf.net/p/docutils/code/trunk"},
22-
SubversionProject,
23-
False,
24-
),
25-
(
26-
{"pip_url": "sv+http://svn.code.sf.net/p/docutils/code/trunk"},
27-
None,
28-
InvalidPipURL,
29-
),
30-
],
31-
)
32-
def test_create_project_from_pip_url(
33-
tmp_path: pathlib.Path, repo_dict, repo_class, raises_exception
34-
):
35-
# add parent_dir via fixture
36-
repo_dict["dir"] = tmp_path / "repo_name"
37-
38-
if raises_exception:
39-
with pytest.raises(raises_exception):
40-
create_project_from_pip_url(**repo_dict)
41-
else:
42-
repo = create_project_from_pip_url(**repo_dict)
43-
assert isinstance(repo, repo_class)
7+
from libvcs.exc import InvalidVCS
448

459

4610
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)