Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mention name of binary we can't find #4947

Merged
merged 2 commits into from Oct 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/python/pants/binaries/binary_util.py
Expand Up @@ -103,8 +103,9 @@ def _select_binary_base_path(self, supportdir, version, name, uname_func=None):
try:
middle_path = self._path_by_id[os_id]
except KeyError:
raise self.MissingMachineInfo('Update --binaries-path-by-id to find binaries for {!r}'
.format(os_id))
raise self.MissingMachineInfo('Unable to find binary {name} version {version}. '
'Update --binaries-path-by-id to find binaries for {os_id!r}'
.format(name=name, version=version, os_id=os_id))
return os.path.join(supportdir, *(middle_path + (version, name)))

def __init__(self, baseurls, timeout_secs, bootstrapdir, path_by_id=None):
Expand Down
18 changes: 9 additions & 9 deletions tests/python/pants_test/binaries/test_binary_util.py
Expand Up @@ -143,8 +143,8 @@ def test_select_binary_base_path_linux(self):
def uname_func():
return "linux", "dontcare1", "dontcare2", "dontcare3", "amd64"

self.assertEquals("supportdir/linux/x86_64/name/version",
binary_util._select_binary_base_path("supportdir", "name", "version",
self.assertEquals("supportdir/linux/x86_64/version/name",
binary_util._select_binary_base_path("supportdir", "version", "name",
uname_func=uname_func))

def test_select_binary_base_path_darwin(self):
Expand All @@ -153,8 +153,8 @@ def test_select_binary_base_path_darwin(self):
def uname_func():
return "darwin", "dontcare1", "14.9", "dontcare2", "dontcare3",

self.assertEquals("supportdir/mac/10.10/name/version",
binary_util._select_binary_base_path("supportdir", "name", "version",
self.assertEquals("supportdir/mac/10.10/version/name",
binary_util._select_binary_base_path("supportdir", "version", "name",
uname_func=uname_func))

def test_select_binary_base_path_missing_os(self):
Expand All @@ -165,7 +165,7 @@ def uname_func():

with self.assertRaisesRegexp(BinaryUtil.MissingMachineInfo,
r'Pants has no binaries for vms'):
binary_util._select_binary_base_path("supportdir", "name", "version", uname_func=uname_func)
binary_util._select_binary_base_path("supportdir", "version", "name", uname_func=uname_func)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should all of the other callsites for _select_binary_base_path in this file invert name<->version too?

that seems to be the method signature:

def _select_binary_base_path(self, supportdir, version, name, uname_func=None):

so it's puzzling why other tests in this file pass them in the wrong order.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Done.


def test_select_binary_base_path_missing_version(self):
binary_util = BinaryUtil([], 0, '/tmp')
Expand All @@ -175,9 +175,9 @@ def uname_func():

os_id = ('darwin', '999')
with self.assertRaisesRegexp(BinaryUtil.MissingMachineInfo,
r'Update --binaries-path-by-id to find binaries for '
r'myname.*Update --binaries-path-by-id to find binaries for '
r'{}'.format(re.escape(repr(os_id)))):
binary_util._select_binary_base_path("supportdir", "name", "version", uname_func=uname_func)
binary_util._select_binary_base_path("supportdir", "myversion", "myname", uname_func=uname_func)

def test_select_binary_base_path_override(self):
binary_util = BinaryUtil([], 0, '/tmp',
Expand All @@ -186,6 +186,6 @@ def test_select_binary_base_path_override(self):
def uname_func():
return "darwin", "dontcare1", "100.99", "dontcare2", "t1000"

self.assertEquals("supportdir/skynet/42/name/version",
binary_util._select_binary_base_path("supportdir", "name", "version",
self.assertEquals("supportdir/skynet/42/version/name",
binary_util._select_binary_base_path("supportdir", "version", "name",
uname_func=uname_func))