Skip to content

Commit 372ae88

Browse files
committed
tests: Skip tests if PyQt6 or PySide6 is not available
Make these tests optional on the availability of the relevant libraries. Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
1 parent 47ca68c commit 372ae88

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

tests/app_test_pyqt6.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
import threading
77
import time
88

9-
from PyQt6 import QtCore
10-
from PyQt6.QtWidgets import (QApplication, QHBoxLayout, QLabel, QPushButton,
11-
QVBoxLayout, QWidget)
12-
13-
from picamera2 import Picamera2
14-
from picamera2.previews.qt import QGl6Picamera2 as QGlPicamera2
9+
try:
10+
from PyQt6 import QtCore
11+
from PyQt6.QtWidgets import (QApplication, QHBoxLayout, QLabel,
12+
QPushButton, QVBoxLayout, QWidget)
13+
14+
from picamera2 import Picamera2
15+
from picamera2.previews.qt import QGl6Picamera2 as QGlPicamera2
16+
except ImportError:
17+
print("SKIPPED (no PyQt6)")
18+
quit()
1519

1620

1721
def post_callback(request):

tests/app_test_pyside6.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
import threading
77
import time
88

9-
from PySide6 import QtCore
10-
from PySide6.QtWidgets import (QApplication, QHBoxLayout, QLabel, QPushButton,
11-
QVBoxLayout, QWidget)
12-
13-
from picamera2 import Picamera2
14-
from picamera2.previews.qt import QGlSide6Picamera2 as QGlPicamera2
9+
try:
10+
from PySide6 import QtCore
11+
from PySide6.QtWidgets import (QApplication, QHBoxLayout, QLabel,
12+
QPushButton, QVBoxLayout, QWidget)
13+
14+
from picamera2 import Picamera2
15+
from picamera2.previews.qt import QGlSide6Picamera2 as QGlPicamera2
16+
except ImportError:
17+
print("SKIPPED (no PySide6)")
18+
quit()
1519

1620

1721
def post_callback(request):

0 commit comments

Comments
 (0)