Skip to content

Commit

Permalink
Mention invalid package name in error message (conda#11601)
Browse files Browse the repository at this point in the history
  • Loading branch information
timhoffm authored Jul 7, 2022
1 parent 204c86a commit 86447b6
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion conda_env/specs/binstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def valid_name(self):
elif self.name is None:
self.msg = "Can't process without a name"
else:
self.msg = "Invalid name, try the format: user/package"
self.msg = f"Invalid name {self.name!r}, try the format: user/package"
return False

def valid_package(self):
Expand Down
19 changes: 19 additions & 0 deletions news/11601-mention-invalid-name-in-error-message
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Include the invalid package name in the error message. (#11601)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
2 changes: 1 addition & 1 deletion tests/conda_env/specs/test_binstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_name_not_present(self):
def test_invalid_name(self):
spec = BinstarSpec(name='invalid-name')
self.assertEqual(spec.can_handle(), False)
self.assertEqual(spec.msg, "Invalid name, try the format: user/package")
self.assertEqual(spec.msg, "Invalid name 'invalid-name', try the format: user/package")

def test_package_not_exist(self):
with patch('conda_env.specs.binstar.get_binstar') as get_binstar_mock:
Expand Down

0 comments on commit 86447b6

Please sign in to comment.