Skip to content

Commit

Permalink
fix(guess): return list instead of odict_keys
Browse files Browse the repository at this point in the history
`run()` uses subscripted access to the return value, which doesn't work
for `odict_keys`.
  • Loading branch information
scop authored and guludo committed Mar 6, 2022
1 parent 9e0ccdc commit 99a1ae1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Changelog

## Unreleased
- Nothing yet.
- Fix subscripted access to guessed venvs return value (@scop)

## 0.1.1 - 2022-02-28
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion src/venvrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def guess():
if os.access(exe, os.X_OK)
)

return venvs.keys()
return list(venvs.keys())


def run():
Expand Down
3 changes: 3 additions & 0 deletions tests/test_venvrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def mock_run(*args, **kwargs):
with patch.object(venvrun.platform, "system", return_value='Linux'), \
patch.object(venvrun.subprocess, "run", mock_run):
venvs = venvrun.guess()
self.assertTrue(venvs[0], "subscriptability")
self.assertListEqual(
sorted(venvs),
sorted(
Expand All @@ -49,6 +50,7 @@ def mock_run(*args, **kwargs):
with patch.object(venvrun.platform, "system", return_value='Linux'), \
patch.object(venvrun.subprocess, "run", mock_run):
venvs = venvrun.guess()
self.assertTrue(venvs[0], "subscriptability")
self.assertListEqual(
sorted(venvs),
sorted(
Expand All @@ -72,6 +74,7 @@ def mock_run(*args, **kwargs):
with patch.object(venvrun.platform, "system", return_value='Linux'), \
patch.object(venvrun.subprocess, "run", mock_run):
venvs = venvrun.guess()
self.assertTrue(venvs[0], "subscriptability")
self.assertListEqual(
sorted(venvs),
sorted(
Expand Down

0 comments on commit 99a1ae1

Please sign in to comment.