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

Depend on nose and pytest at installation #57

Closed
ghisvail opened this issue Feb 8, 2017 · 3 comments
Closed

Depend on nose and pytest at installation #57

ghisvail opened this issue Feb 8, 2017 · 3 comments
Assignees
Milestone

Comments

@ghisvail
Copy link
Contributor

ghisvail commented Feb 8, 2017

Right now, the plugin offers to run pytest or nose on a folder or your choice. There is however nothing forcing users to have any, one or both test frameworks available in their environment. Regardless, the selection box offer all test frameworks, which may lead to problems later.

Could this be made a bit more adaptive somehow? For instance, by greying out selection of test frameworks for which a test import failed?

Otherwise, perhaps there should be an install dependency on nose and pytest?

@jitseniesen
Copy link
Member

Could this be made a bit more adaptive somehow? For instance, by greying out selection of test frameworks for which a test import failed?

This is indeed the plan. Actually, this is what issue #15 is about. But it needs to be programmed.

Otherwise, perhaps there should be an install dependency on nose and pytest?

Yep, these dependencies should be added while the greying out is not yet implemented.

@jitseniesen jitseniesen added this to the v0.1.1 milestone Feb 8, 2017
@jitseniesen jitseniesen self-assigned this Feb 8, 2017
@ghisvail
Copy link
Contributor Author

ghisvail commented Feb 8, 2017

Yep, these dependencies should be added while the greying out is not yet implemented.

Thanks for confirming. That's what I have done.

@bilderbuchi
Copy link

Yep, these dependencies should be added while the greying out is not yet implemented.

You can check if packages are available with importlib.util.find_spec():

nose_available = bool(importlib.util.find_spec('nose'))
pytest_available = bool(importlib.util.find_spec('pytest'))

This is Python 3.4+, and has the benefit that it does not import the package in question, as opposed to the older try-import-except-ImportError method.
See http://stackoverflow.com/questions/14050281/how-to-check-if-a-python-module-exists-without-importing-it and https://docs.python.org/3/library/importlib.html#importlib.util.find_spec

@jitseniesen jitseniesen changed the title Adapt selection of test frameworks based on their availability Depend on nose and pytest at installation Feb 9, 2017
jitseniesen added a commit to jitseniesen/spyder-unittest that referenced this issue Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants