Skip to content

Commit 0f7b181

Browse files
authored
PR: Update pytest.importorskip usage (CI) (#486)
2 parents d76a59b + 67285c4 commit 0f7b181

35 files changed

+107
-38
lines changed

qtpy/tests/test_main.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import pytest
77

88
from qtpy import API_NAMES, QtCore, QtGui, QtWidgets
9+
from qtpy.tests.utils import pytest_importorskip
910

1011
with contextlib.suppress(Exception):
1112
# removed in qt 6.0
@@ -112,7 +113,7 @@ def test_qt_api_environ(api):
112113
If no QT_API is specified but some Qt is imported, ensure QT_API is set properly.
113114
"""
114115
mod = f"{api}.QtCore"
115-
pytest.importorskip(mod, reason=f"Requires {api}")
116+
pytest_importorskip(mod, reason=f"Requires {api}")
116117
# clean env
117118
env = os.environ.copy()
118119
for key in ("QT_API", "USE_QT_API"):

qtpy/tests/test_qsci.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from qtpy import PYSIDE2, PYSIDE6
6-
from qtpy.tests.utils import using_conda
6+
from qtpy.tests.utils import pytest_importorskip, using_conda
77

88

99
@pytest.mark.skipif(
@@ -12,7 +12,7 @@
1212
)
1313
def test_qsci():
1414
"""Test the qtpy.Qsci namespace"""
15-
Qsci = pytest.importorskip("qtpy.Qsci")
15+
Qsci = pytest_importorskip("qtpy.Qsci")
1616
assert Qsci.QSCINTILLA_VERSION is not None
1717
assert Qsci.QSCINTILLA_VERSION_STR is not None
1818
assert Qsci.QsciAPIs is not None

qtpy/tests/test_qt3danimation.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qt3danimation():
57
"""Test the qtpy.Qt3DAnimation namespace"""
6-
Qt3DAnimation = pytest.importorskip("qtpy.Qt3DAnimation")
8+
Qt3DAnimation = pytest_importorskip("qtpy.Qt3DAnimation")
79

810
assert Qt3DAnimation.QAnimationController is not None
911
assert Qt3DAnimation.QAdditiveClipBlend is not None

qtpy/tests/test_qt3dcore.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import pytest
22

33
from qtpy import PYQT6, PYSIDE6
4+
from qtpy.tests.utils import pytest_importorskip
45

56

67
@pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6")
78
@pytest.mark.skipif(PYSIDE6, reason="Not complete in PySide6")
89
def test_qt3dcore():
910
"""Test the qtpy.Qt3DCore namespace"""
10-
Qt3DCore = pytest.importorskip("qtpy.Qt3DCore")
11+
Qt3DCore = pytest_importorskip("qtpy.Qt3DCore")
1112

1213
assert Qt3DCore.QPropertyValueAddedChange is not None
1314
assert Qt3DCore.QSkeletonLoader is not None

qtpy/tests/test_qt3dextras.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qt3dextras():
57
"""Test the qtpy.Qt3DExtras namespace"""
6-
Qt3DExtras = pytest.importorskip("qtpy.Qt3DExtras")
8+
Qt3DExtras = pytest_importorskip("qtpy.Qt3DExtras")
79

810
assert Qt3DExtras.QTextureMaterial is not None
911
assert Qt3DExtras.QPhongAlphaMaterial is not None

qtpy/tests/test_qt3dinput.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qt3dinput():
57
"""Test the qtpy.Qt3DInput namespace"""
6-
Qt3DInput = pytest.importorskip("qtpy.Qt3DInput")
8+
Qt3DInput = pytest_importorskip("qtpy.Qt3DInput")
79

810
assert Qt3DInput.QAxisAccumulator is not None
911
assert Qt3DInput.QInputSettings is not None

qtpy/tests/test_qt3dlogic.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qt3dlogic():
57
"""Test the qtpy.Qt3DLogic namespace"""
6-
Qt3DLogic = pytest.importorskip("qtpy.Qt3DLogic")
8+
Qt3DLogic = pytest_importorskip("qtpy.Qt3DLogic")
79

810
assert Qt3DLogic.QLogicAspect is not None
911
assert Qt3DLogic.QFrameAction is not None

qtpy/tests/test_qt3drender.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import pytest
22

33
from qtpy import PYQT6, PYSIDE6
4+
from qtpy.tests.utils import pytest_importorskip
45

56

67
@pytest.mark.skipif(PYQT6, reason="Not complete in PyQt6")
78
@pytest.mark.skipif(PYSIDE6, reason="Not complete in PySide6")
89
def test_qt3drender():
910
"""Test the qtpy.Qt3DRender namespace"""
10-
Qt3DRender = pytest.importorskip("qtpy.Qt3DRender")
11+
Qt3DRender = pytest_importorskip("qtpy.Qt3DRender")
1112

1213
assert Qt3DRender.QPointSize is not None
1314
assert Qt3DRender.QFrustumCulling is not None

qtpy/tests/test_qtaxcontainer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtaxcontainer():
57
"""Test the qtpy.QtAxContainer namespace"""
6-
QtAxContainer = pytest.importorskip("qtpy.QtAxContainer")
8+
QtAxContainer = pytest_importorskip("qtpy.QtAxContainer")
79

810
assert QtAxContainer.QAxSelect is not None
911
assert QtAxContainer.QAxWidget is not None

qtpy/tests/test_qtbluetooth.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtbluetooth():
57
"""Test the qtpy.QtBluetooth namespace"""
6-
QtBluetooth = pytest.importorskip("qtpy.QtBluetooth")
8+
QtBluetooth = pytest_importorskip("qtpy.QtBluetooth")
79

810
assert QtBluetooth.QBluetooth is not None
911
assert QtBluetooth.QBluetoothDeviceInfo is not None

qtpy/tests/test_qtcharts.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pytest
22

33
from qtpy import PYSIDE2, PYSIDE6
4+
from qtpy.tests.utils import pytest_importorskip
45

56

67
@pytest.mark.skipif(
@@ -9,7 +10,7 @@
910
)
1011
def test_qtcharts():
1112
"""Test the qtpy.QtCharts namespace"""
12-
QtCharts = pytest.importorskip("qtpy.QtCharts")
13+
QtCharts = pytest_importorskip("qtpy.QtCharts")
1314

1415
assert QtCharts.QChart is not None
1516
assert QtCharts.QtCharts.QChart is not None

qtpy/tests/test_qtconcurrent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
from packaging.version import parse
33

44
from qtpy import PYSIDE2, PYSIDE_VERSION
5+
from qtpy.tests.utils import pytest_importorskip
56

67

78
def test_qtconcurrent():
89
"""Test the qtpy.QtConcurrent namespace"""
9-
QtConcurrent = pytest.importorskip("qtpy.QtConcurrent")
10+
QtConcurrent = pytest_importorskip("qtpy.QtConcurrent")
1011

1112
assert QtConcurrent.QtConcurrent is not None
1213

qtpy/tests/test_qtdatavisualization.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtdatavisualization():
57
"""Test the qtpy.QtDataVisualization namespace"""
@@ -8,7 +10,7 @@ def test_qtdatavisualization():
810
# For example in the case of `PyQt5` you need `PyQtDataVisualization`
911

1012
# QtDataVisualization
11-
QtDataVisualization = pytest.importorskip("qtpy.QtDataVisualization")
13+
QtDataVisualization = pytest_importorskip("qtpy.QtDataVisualization")
1214
assert QtDataVisualization.QScatter3DSeries is not None
1315
assert QtDataVisualization.QSurfaceDataItem is not None
1416
assert QtDataVisualization.QSurface3DSeries is not None
@@ -47,7 +49,7 @@ def test_qtdatavisualization():
4749

4850
# QtDatavisualization
4951
# import qtpy to get alias for `QtDataVisualization` with lower `v`
50-
qtpy = pytest.importorskip("qtpy")
52+
qtpy = pytest_importorskip("qtpy")
5153

5254
assert qtpy.QtDatavisualization.QScatter3DSeries is not None
5355
assert qtpy.QtDatavisualization.QSurfaceDataItem is not None

qtpy/tests/test_qtdbus.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtdbus():
57
"""Test the qtpy.QtDBus namespace"""
6-
QtDBus = pytest.importorskip("qtpy.QtDBus")
8+
QtDBus = pytest_importorskip("qtpy.QtDBus")
79

810
assert QtDBus.QDBusAbstractAdaptor is not None
911
assert QtDBus.QDBusAbstractInterface is not None

qtpy/tests/test_qtdesigner.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import pytest
22

33
from qtpy import PYSIDE2
4+
from qtpy.tests.utils import pytest_importorskip
45

56

67
@pytest.mark.skipif(PYSIDE2, reason="QtDesigner is not available in PySide2")
78
def test_qtdesigner():
89
"""Test the qtpy.QtDesigner namespace."""
9-
QtDesigner = pytest.importorskip("qtpy.QtDesigner")
10+
QtDesigner = pytest_importorskip("qtpy.QtDesigner")
1011

1112
assert QtDesigner.QAbstractExtensionFactory is not None
1213
assert QtDesigner.QAbstractExtensionManager is not None

qtpy/tests/test_qtmacextras.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import pytest
44

55
from qtpy import PYQT6, PYSIDE6
6-
from qtpy.tests.utils import using_conda
6+
from qtpy.tests.utils import pytest_importorskip, using_conda
77

88

99
@pytest.mark.skipif(
@@ -16,7 +16,7 @@
1616
)
1717
def test_qtmacextras():
1818
"""Test the qtpy.QtMacExtras namespace"""
19-
QtMacExtras = pytest.importorskip("qtpy.QtMacExtras")
19+
QtMacExtras = pytest_importorskip("qtpy.QtMacExtras")
2020

2121
assert QtMacExtras.QMacPasteboardMime is not None
2222
assert QtMacExtras.QMacToolBar is not None

qtpy/tests/test_qtnetworkauth.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import pytest
22

33
from qtpy import PYQT5, PYQT6, PYSIDE2
4+
from qtpy.tests.utils import pytest_importorskip
45

56

67
@pytest.mark.skipif(PYSIDE2, reason="Not available for PySide2")
78
def test_qtnetworkauth():
89
"""Test the qtpy.QtNetworkAuth namespace"""
9-
QtNetworkAuth = pytest.importorskip("qtpy.QtNetworkAuth")
10+
QtNetworkAuth = pytest_importorskip("qtpy.QtNetworkAuth")
1011

1112
assert QtNetworkAuth.QAbstractOAuth is not None
1213
assert QtNetworkAuth.QAbstractOAuth2 is not None

qtpy/tests/test_qtpdf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtpdf():
57
"""Test the qtpy.QtPdf namespace"""
6-
QtPdf = pytest.importorskip("qtpy.QtPdf")
8+
QtPdf = pytest_importorskip("qtpy.QtPdf")
79

810
assert QtPdf.QPdfDocument is not None
911
assert QtPdf.QPdfLink is not None

qtpy/tests/test_qtpdfwidgets.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtpdfwidgets():
57
"""Test the qtpy.QtPdfWidgets namespace"""
6-
QtPdfWidgets = pytest.importorskip("qtpy.QtPdfWidgets")
8+
QtPdfWidgets = pytest_importorskip("qtpy.QtPdfWidgets")
79

810
assert QtPdfWidgets.QPdfView is not None

qtpy/tests/test_qtpurchasing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtpurchasing():
57
"""Test the qtpy.QtPurchasing namespace"""
6-
QtPurchasing = pytest.importorskip("qtpy.QtPurchasing")
8+
QtPurchasing = pytest_importorskip("qtpy.QtPurchasing")
79

810
assert QtPurchasing.QInAppProduct is not None
911
assert QtPurchasing.QInAppStore is not None

qtpy/tests/test_qtquick3d.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtquick3d():
57
"""Test the qtpy.QtQuick3D namespace"""
6-
QtQuick3D = pytest.importorskip("qtpy.QtQuick3D")
8+
QtQuick3D = pytest_importorskip("qtpy.QtQuick3D")
79

810
assert QtQuick3D.QQuick3D is not None
911
assert QtQuick3D.QQuick3DGeometry is not None

qtpy/tests/test_qtquickcontrols2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtquickcontrols2():
57
"""Test the qtpy.QtQuickControls2 namespace"""
6-
QtQuickControls2 = pytest.importorskip("qtpy.QtQuickControls2")
8+
QtQuickControls2 = pytest_importorskip("qtpy.QtQuickControls2")
79

810
assert QtQuickControls2.QQuickStyle is not None

qtpy/tests/test_qtremoteobjects.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtremoteobjects():
57
"""Test the qtpy.QtRemoteObjects namespace"""
6-
QtRemoteObjects = pytest.importorskip("qtpy.QtRemoteObjects")
8+
QtRemoteObjects = pytest_importorskip("qtpy.QtRemoteObjects")
79

810
assert QtRemoteObjects.QRemoteObjectAbstractPersistedStore is not None
911
assert QtRemoteObjects.QRemoteObjectDynamicReplica is not None

qtpy/tests/test_qtscxml.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtscxml():
57
"""Test the qtpy.QtScxml namespace"""
6-
QtScxml = pytest.importorskip("qtpy.QtScxml")
8+
QtScxml = pytest_importorskip("qtpy.QtScxml")
79

810
assert QtScxml.QScxmlCompiler is not None
911
assert QtScxml.QScxmlDynamicScxmlServiceFactory is not None

qtpy/tests/test_qtstatemachine.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtstatemachine():
57
"""Test the qtpy.QtStateMachine namespace"""
6-
QtStateMachine = pytest.importorskip("qtpy.QtStateMachine")
8+
QtStateMachine = pytest_importorskip("qtpy.QtStateMachine")
79

810
assert QtStateMachine.QAbstractState is not None
911
assert QtStateMachine.QAbstractTransition is not None

qtpy/tests/test_qtsvgwidgets.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtsvgwidgets():
57
"""Test the qtpy.QtSvgWidgets namespace"""
6-
QtSvgWidgets = pytest.importorskip("qtpy.QtSvgWidgets")
8+
QtSvgWidgets = pytest_importorskip("qtpy.QtSvgWidgets")
79

810
assert QtSvgWidgets.QGraphicsSvgItem is not None
911
assert QtSvgWidgets.QSvgWidget is not None

qtpy/tests/test_qtuitools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import pytest
22

3+
from qtpy.tests.utils import pytest_importorskip
4+
35

46
def test_qtuitools():
57
"""Test the qtpy.QtUiTools namespace"""
6-
QtUiTools = pytest.importorskip("qtpy.QtUiTools")
8+
QtUiTools = pytest_importorskip("qtpy.QtUiTools")
79

810
assert QtUiTools.QUiLoader is not None

0 commit comments

Comments
 (0)