Skip to content

Commit 9cae8fd

Browse files
authored
Skip running the tests on Windows Debug. (#142)
* Skip running the tests on Windows Debug. When we run CI on Windows Debug, Python expects to be able to find compiled libraries with an extra _d in their filename that contains the debugging ABI. However, we don't currently have a debug library available for PyQt5, and thus when running under Windows Debug, the tests cannot succeed. While we could build a debug library for PyQt5, that is actually a massive undertaking. Instead, just skip these tests when we are on Windows Debug. While that loses us a bit of coverage, it won't matter much; we are still testing this on Windows (Release) and on Linux. The way in which this patch determines that this is a Windows Debug interpreter is a little chintzy. It just uses the fact that the binary is named python_d.exe to discover that. I couldn't find another way to tell if this was a debug interpreter, but I am open to other ideas. Signed-off-by: Chris Lalancette <clalancette@gmail.com> * Update to using importlib.machinery. Thanks to Shane for figuring out this way to tell if we are in a debug interpreter. Signed-off-by: Chris Lalancette <clalancette@gmail.com> --------- Signed-off-by: Chris Lalancette <clalancette@gmail.com>
1 parent 1fbfb44 commit 9cae8fd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/test_imports.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,39 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import importlib.machinery
16+
import sys
1517

18+
import pytest
19+
20+
21+
# If this is running on a Python Windows interpreter built in debug mode, skip running tests
22+
# because we do not have the debug libraries available for PyQt. It is surprisingly tricky to
23+
# discover whether the current interpreter was built in debug mode (note that this is different
24+
# than running the interpreter in debug mode, i.e. PYTHONDEBUG=1). The only non-deprecated way
25+
# we've found is to look for _d.pyd in the extension suffixes, so that is what we do here.
26+
is_windows_debug = sys.platform == 'win32' and '_d.pyd' in importlib.machinery.EXTENSION_SUFFIXES
27+
28+
29+
@pytest.mark.skipif(is_windows_debug, reason='Skipping test on Windows Debug')
1630
def test_import_qtcore():
1731
from python_qt_binding import QtCore
1832
assert QtCore is not None
1933

2034

35+
@pytest.mark.skipif(is_windows_debug, reason='Skipping test on Windows Debug')
2136
def test_import_qtgui():
2237
from python_qt_binding import QtGui
2338
assert QtGui is not None
2439

2540

41+
@pytest.mark.skipif(is_windows_debug, reason='Skipping test on Windows Debug')
2642
def test_import_qtwidgets():
2743
from python_qt_binding import QtWidgets
2844
assert QtWidgets is not None
2945

3046

47+
@pytest.mark.skipif(is_windows_debug, reason='Skipping test on Windows Debug')
3148
def test_import_qtobject():
3249
from python_qt_binding.QtCore import QObject
3350
assert QObject is not None

0 commit comments

Comments
 (0)