Reenable PyQt 5.6 PyPI tests
To avoid segfaults we need to hardcode the sip version. We also need to write a Qt.conf as it was missing with PyQt 5.6 and QtWebEngine can't find its resources.
This commit is contained in:
parent
79d22f2505
commit
abded2470a
@ -21,6 +21,10 @@ matrix:
|
|||||||
- os: linux
|
- os: linux
|
||||||
env: DOCKER=ubuntu-xenial
|
env: DOCKER=ubuntu-xenial
|
||||||
services: docker
|
services: docker
|
||||||
|
- os: linux
|
||||||
|
language: python
|
||||||
|
python: 3.5
|
||||||
|
env: TESTENV=py35-pyqt56
|
||||||
- os: linux
|
- os: linux
|
||||||
language: python
|
language: python
|
||||||
python: 3.6
|
python: 3.6
|
||||||
|
@ -154,6 +154,15 @@ def link_pyqt(executable, venv_path):
|
|||||||
copy_or_link(path, dest)
|
copy_or_link(path, dest)
|
||||||
|
|
||||||
|
|
||||||
|
def patch_pypi_pyqt(venv_path):
|
||||||
|
executable = get_venv_executable(venv_path)
|
||||||
|
pyqt_dir = os.path.dirname(get_lib_path(executable, 'PyQt5.QtCore'))
|
||||||
|
qt_conf = os.path.join(pyqt_dir, 'Qt', 'libexec', 'qt.conf')
|
||||||
|
with open(qt_conf, 'w', encoding='utf-8') as f:
|
||||||
|
f.write('[Paths]\n')
|
||||||
|
f.write('Prefix = ..\n')
|
||||||
|
|
||||||
|
|
||||||
def copy_or_link(source, dest):
|
def copy_or_link(source, dest):
|
||||||
"""Copy or symlink source to dest."""
|
"""Copy or symlink source to dest."""
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
@ -177,11 +186,15 @@ def remove(filename):
|
|||||||
os.unlink(filename)
|
os.unlink(filename)
|
||||||
|
|
||||||
|
|
||||||
|
def get_venv_executable(path):
|
||||||
|
"""Get the Python executable in a virtualenv."""
|
||||||
|
subdir = 'Scripts' if os.name == 'nt' else 'bin'
|
||||||
|
return os.path.join(path, subdir, 'python')
|
||||||
|
|
||||||
|
|
||||||
def get_venv_lib_path(path):
|
def get_venv_lib_path(path):
|
||||||
"""Get the library path of a virtualenv."""
|
"""Get the library path of a virtualenv."""
|
||||||
subdir = 'Scripts' if os.name == 'nt' else 'bin'
|
return run_py(get_venv_executable(path),
|
||||||
executable = os.path.join(path, subdir, 'python')
|
|
||||||
return run_py(executable,
|
|
||||||
'from distutils.sysconfig import get_python_lib',
|
'from distutils.sysconfig import get_python_lib',
|
||||||
'print(get_python_lib())')
|
'print(get_python_lib())')
|
||||||
|
|
||||||
@ -200,13 +213,17 @@ def main():
|
|||||||
parser.add_argument('path', help="Base path to the venv.")
|
parser.add_argument('path', help="Base path to the venv.")
|
||||||
parser.add_argument('--tox', help="Add when called via tox.",
|
parser.add_argument('--tox', help="Add when called via tox.",
|
||||||
action='store_true')
|
action='store_true')
|
||||||
|
parser.add_argument('--pypi', help="Patch a PyPI-installed PyQt 5.6",
|
||||||
|
action='store_true')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if args.pypi:
|
||||||
|
patch_pypi_pyqt(args.path)
|
||||||
|
else:
|
||||||
if args.tox:
|
if args.tox:
|
||||||
executable = get_tox_syspython(args.path)
|
executable = get_tox_syspython(args.path)
|
||||||
else:
|
else:
|
||||||
executable = sys.executable
|
executable = sys.executable
|
||||||
|
|
||||||
venv_path = get_venv_lib_path(args.path)
|
venv_path = get_venv_lib_path(args.path)
|
||||||
link_pyqt(executable, venv_path)
|
link_pyqt(executable, venv_path)
|
||||||
|
|
||||||
|
5
tox.ini
5
tox.ini
@ -66,7 +66,10 @@ passenv = {[testenv]passenv}
|
|||||||
deps =
|
deps =
|
||||||
{[testenv]deps}
|
{[testenv]deps}
|
||||||
PyQt5==5.6
|
PyQt5==5.6
|
||||||
commands = {envpython} scripts/dev/run_pytest.py {posargs:tests}
|
sip==4.18.1
|
||||||
|
commands =
|
||||||
|
{envpython} scripts/link_pyqt.py --pypi {envdir}
|
||||||
|
{envpython} scripts/dev/run_pytest.py {posargs:tests}
|
||||||
|
|
||||||
[testenv:py35-pyqt571]
|
[testenv:py35-pyqt571]
|
||||||
basepython = python3.5
|
basepython = python3.5
|
||||||
|
Loading…
Reference in New Issue
Block a user