Skip to content

Commit 82e1557

Browse files
committed
First attempt of running PyQt on travis
1 parent 4bd8a34 commit 82e1557

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ before_script:
99
env:
1010
- PYTEST_VERSION=2.4.2
1111
- PYTEST_VERSION=2.5.2
12+
- PYTEST_QT_FORCE_PYQT=true
13+
#- PYTEST_QT_FORCE_PYQT=false
1214

1315
install:
14-
- sudo apt-get install -qq python-pyside
15-
- ln -s /usr/lib/python$TRAVIS_PYTHON_VERSION/dist-packages/PySide /home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION/lib/python$TRAVIS_PYTHON_VERSION/site-packages/PySide -v
16+
#- if [[ $PYTEST_QT_FORCE_PYQT == 'false' ]]; then sudo apt-get install -qq python-pyside; fi
17+
#- ln -s /usr/lib/python$TRAVIS_PYTHON_VERSION/dist-packages/PySide /home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION/lib/python$TRAVIS_PYTHON_VERSION/site-packages/PySide -v
18+
- if [[ $PYTEST_QT_FORCE_PYQT == 'true' ]]; then sudo apt-get install -qq python-qt4; fi
19+
- if [[ $PYTEST_QT_FORCE_PYQT == 'true' ]]; then ln -s /usr/lib/python$TRAVIS_PYTHON_VERSION/dist-packages/PyQt4 /home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION/lib/python$TRAVIS_PYTHON_VERSION/site-packages/PyQt4 -v; fi
20+
- if [[ $PYTEST_QT_FORCE_PYQT == 'true' ]]; then ln -s /usr/lib/python$TRAVIS_PYTHON_VERSION/dist-packages/sip* /home/travis/virtualenv/python$TRAVIS_PYTHON_VERSION/lib/python$TRAVIS_PYTHON_VERSION/site-packages -v; fi
1621
- pip uninstall -y pytest
1722
- pip install pytest==$PYTEST_VERSION
1823

pytestqt/qt_compat.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,19 @@
1414
try:
1515
import PySide.QtCore as _QtCore
1616
QtCore = _QtCore
17-
USES_PYSIDE = True
17+
PYSIDE_AVAILABLE = True
1818
except ImportError:
19+
PYSIDE_AVAILABLE = False
20+
21+
FORCE_PYQT = os.environ.get('PYTEST_QT_FORCE_PYQT', 'false') == 'true'
22+
if not PYSIDE_AVAILABLE or FORCE_PYQT:
23+
PYSIDE_AVAILABLE = False
1924
import sip
2025
sip.setapi('QString', 2)
2126
sip.setapi('QVariant', 2)
2227
import PyQt4.QtCore as _QtCore
2328
QtCore = _QtCore
24-
USES_PYSIDE = False
25-
26-
29+
2730
def _pyside_import_module(moduleName):
2831
pyside = __import__('PySide', globals(), locals(), [moduleName], -1)
2932
return getattr(pyside, moduleName)
@@ -34,7 +37,7 @@ def _pyqt4_import_module(moduleName):
3437
return getattr(pyside, moduleName)
3538

3639

37-
if USES_PYSIDE:
40+
if PYSIDE_AVAILABLE:
3841
import_module = _pyside_import_module
3942

4043
Signal = QtCore.Signal

0 commit comments

Comments
 (0)