Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Reorganize QtCharts module import and add missing skip validation for QtNetworkAuth test with PyQt6 #260

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions qtpy/QtCharts.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@

if PYQT5:
try:
from PyQt5 import QtChart as QtCharts
from PyQt5.QtChart import *
except ImportError:
raise PythonQtError('The QtChart module was not found. '
'It needs to be installed separately for PyQt5.')
elif PYQT6:
from PyQt6 import QtCharts
try:
from PyQt6.QtCharts import *
except ImportError:
raise PythonQtError('The QtCharts module was not found. '
'It needs to be installed separately for PyQt6.')
elif PYSIDE6:
from PySide6 import QtCharts
from PySide6.QtCharts import *
elif PYSIDE2:
from PySide2.QtCharts import *
# https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-1026
import PySide2.QtCharts as __temp
import inspect
for __name in inspect.getmembers(__temp.QtCharts):
globals()[__name[0]] = __name[1]
else:
raise PythonQtError('No Qt bindings could be found')
3 changes: 2 additions & 1 deletion qtpy/tests/test_qtcharts.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import pytest

from qtpy import PYSIDE2, PYSIDE6


@pytest.mark.skipif(not (PYSIDE2 or PYSIDE6), reason="Only available by default in PySide")
def test_qtcharts():
"""Test the qtpy.QtCharts namespace"""
from qtpy import QtCharts
assert QtCharts.QtCharts.QChart is not None
assert QtCharts.QChart is not None
6 changes: 4 additions & 2 deletions qtpy/tests/test_qtnetworkauth.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import pytest
from qtpy import PYQT5, PYQT6, PYSIDE2, PYSIDE6

@pytest.mark.skipif(PYSIDE2 or PYQT5, reason="Not available in CI")
from qtpy import PYQT5, PYQT6, PYSIDE2

@pytest.mark.skipif(PYQT5 or PYQT6 or PYSIDE2,
reason="Not available by default in PyQt. Not available for PySide2")
def test_qtnetworkauth():
"""Test the qtpy.QtNetworkAuth namespace"""
from qtpy import QtNetworkAuth
Expand Down