PR: Define Qt/binding versions at top level, fix warnings if versions not found, and fix test dir on CIs #292
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.
Followup to merging PR #289 to
master
following a very weird and unexpected check failure on Win 10 + PyQt 5.9 + conda + Python 3.6; see CI logs.Seems like there's some weird behavior on this very specific CI run, where the tests pass, but when we run the command to save the path for the test coverage, which imports QtPy a second time in a new instance of the same interpreter,
QT_VERSION
is not defined, which must mean that all theif
blocks either didn't trigger or had anImportError
and QtPy fell back to using PyQt5. I could understand if PyQt 5.9 didn't define those top-level constants (since the source repo is not public, I tried to check beforehand but couldn't), but the fact that it worked without error the first time for the tests leads me to believe that it must either have been something with setting the env variables that triggered the different behavior on the second, or there's something else I'm not accounting for going on.EDIT: It was the latter, the second Python command was run without
-I
which resulted in shadowing due to the hack I used to avoid problems due to the non-src directory layout. See below for full details.While this PR fixes the proximate error and ensures that the top-level constants are always at least defined, I want to see if I can reproduce this locally in the same env, as it may indicate an underlying issue.Done, see below.So, this PR implements three levels of fixes to the related issues discovered here:
QT_VERSION
is defined first before acting on it (like all the others)None
at the top of the file, which avoids them being undefined if no Qt API is found and also reduces duplication and verbosity