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

Fix python3 compatibility bug in spack edit command #6748

Merged
merged 1 commit into from
Dec 22, 2017

Conversation

adamjstewart
Copy link
Member

Fixes a Python 3 compatibility bug introduced by #6416.

When run with Python 3, I get the following error message:

$ spack edit -b python
==> Error: object of type 'filter' has no len()

In Python 2, filter() returns a list, but in Python 3, filter() returns an iterator, and iterators have no length.

@becker33

P.S. Thoughts on how to write unit tests for spack edit? We're currently getting 37% coverage...

@scheibelp scheibelp merged commit 1ce0c1b into spack:develop Dec 22, 2017
@scheibelp
Copy link
Member

Thanks!

Regarding

Thoughts on how to write unit tests for spack edit?

I think the easiest way to get better coverage is to mock spack.editor and the filesystem calls (e.g. replace glob.glob with filesystem.glob and then provide a mock filesystem for testing).

@adamjstewart adamjstewart deleted the fixes/python3-edit branch December 22, 2017 16:47
ch741 pushed a commit to ch741/spack that referenced this pull request Apr 20, 2018
In Python 2, filter() returns a list, but in Python 3, filter()
returns an iterator, and iterators have no length.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants