Improve import handling for QtPy#656
Open
kif wants to merge 4 commits into
Open
Conversation
Modified import statements to handle potential ImportError for QtPy. Close # 654
Add error handling for QtPy import failure
Handle ImportError for qtpy and manage environment variable for testing.
Wrap Qt imports in a try-except block to handle ImportError and check environment variable.
Member
Author
|
@t20100 One could have QtPy available inside fabio as a single entry-point if this is finally accepted. |
Member
Author
|
I twisted CI, now tests are passing, this is probably not useful, at least not for this release. |
Member
|
If it's only for the something like: def test_import_all(self):
import fabio
skip_without_qt = {
"fabio.app.viewer",
"fabio.qt.dialogs",
"fabio.qt.matplotlib",
}
with_qt = os.environ.get("WITH_QT_TEST", "True").lower() not in ("0", "false", "no")
base = os.path.split(fabio.__path__[0])[0] + "/"
for root, dirs, files in os.walk(fabio.__path__[0]):
for f in files:
if f.endswith(".py"):
module = os.path.join(root, f[:-3])[len(base):].replace(os.sep, ".")
if not with_qt and module in skip_without_qt:
continue
__import__(module) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modified import statements to handle potential ImportError for QtPy.
Close # 654