Skip to content

Commit

Permalink
QtDataVisualization: Fix importing with alias when the module doesn't…
Browse files Browse the repository at this point in the history
… exists
  • Loading branch information
dalthviz committed Sep 21, 2021
1 parent 704826d commit 35007f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 5 additions & 3 deletions qtpy/__init__.py
Expand Up @@ -231,7 +231,9 @@ class PythonQtWarning(Warning):
except AttributeError:
pass

if (PYQT5 or PYSIDE2) and PY2 and sys.platform == "win32":
# QtDataVisualization backward compatibility (valid also on Windows)
# Only available for Python 2 on Windows and Qt5 bindings
try:
# QtDataVisualization backward compatibility (QtDataVisualization vs. QtDatavisualization)
# Only available for Qt5 bindings > 5.9 on Windows
from . import QtDataVisualization as QtDatavisualization
except ImportError:
pass
8 changes: 3 additions & 5 deletions qtpy/tests/test_qtwinextras.py
Expand Up @@ -4,13 +4,11 @@
import sys

import pytest
from qtpy import PYQT5, PYSIDE2
from qtpy.py3compat import PY3
from qtpy import PYSIDE2

@pytest.mark.skipif(
sys.platform != "win32" or not (PYQT5 or PYSIDE2) or
os.environ['USE_CONDA'] == 'Yes' and PY3 and PYQT5,
reason="Only available in Qt5 bindings and Windows platform")
sys.platform != "win32" or os.environ['USE_CONDA'] == 'Yes',
reason="Only available in Qt5 bindings > 5.9 (only available with pip in the current CI setup) and Windows platform")
def test_qtwinextras():
"""Test the qtpy.QtWinExtras namespace"""
from qtpy import QtWinExtras
Expand Down

0 comments on commit 35007f3

Please sign in to comment.