Skip to content

Commit

Permalink
More descriptive function name.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrahunt committed Sep 7, 2019
1 parent 3da9a89 commit f92961d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/pip/_internal/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@ class MissingCallableSuffix(Exception):
pass


def _assert_valid_entrypoint(specification):
def _raise_for_invalid_entrypoint(specification):
entry = get_export_entry(specification)
if entry is not None and entry.suffix is None:
raise MissingCallableSuffix(str(entry))


class PipScriptMaker(ScriptMaker):
def make(self, specification, options=None):
_assert_valid_entrypoint(specification)
_raise_for_invalid_entrypoint(specification)
return super(PipScriptMaker, self).make(specification, options)


Expand Down
13 changes: 8 additions & 5 deletions tests/unit/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
from pip._internal.req.req_install import InstallRequirement
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.misc import unpack_file
from pip._internal.wheel import MissingCallableSuffix, _assert_valid_entrypoint
from pip._internal.wheel import (
MissingCallableSuffix,
_raise_for_invalid_entrypoint,
)
from tests.lib import DATA_DIR, assert_paths_equal


Expand Down Expand Up @@ -266,17 +269,17 @@ def test_get_entrypoints(tmpdir, console_scripts):
)


def test_assert_valid_entrypoint_ok():
_assert_valid_entrypoint("hello = hello:main")
def test_raise_for_invalid_entrypoint_ok():
_raise_for_invalid_entrypoint("hello = hello:main")


@pytest.mark.parametrize("entrypoint", [
"hello = hello",
"hello = hello:",
])
def test_assert_valid_entrypoint_fail(entrypoint):
def test_raise_for_invalid_entrypoint_fail(entrypoint):
with pytest.raises(MissingCallableSuffix):
_assert_valid_entrypoint(entrypoint)
_raise_for_invalid_entrypoint(entrypoint)


@pytest.mark.parametrize("outrows, expected", [
Expand Down

0 comments on commit f92961d

Please sign in to comment.