Skip to content

version 2.0.0 breaks pyqt4 api v2 #148

@montefra

Description

@montefra

Running tests via tox with pytest-qt==2.0.0 with pyqt4 and api v2 gives me:

py27 runtests: commands[1] | py.test
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/_pytest/main.py", line 90, in wrap_session
INTERNALERROR> config._do_configure()
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/_pytest/config.py", line 839, in _do_configure
INTERNALERROR> self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 729, in call_historic
INTERNALERROR> self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 338, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 333, in
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 596, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/pytestqt/plugin.py", line 167, in pytest_configure
INTERNALERROR> qt_api.set_qt_api(config.getini('qt_api'))
INTERNALERROR> File "/.../.tox/py27/local/lib/python2.7/site-packages/pytestqt/qt_compat.py", line 74, in set_qt_api
INTERNALERROR> sip.setapi("QDate", 2)
INTERNALERROR> ValueError: API 'QDate' has already been set to version 1
ERROR: InvocationError: '/.../.tox/py27/bin/py.test'

Version 1.11.0 runs correctly.

According to git bisects the offending commit is:

commit aaada5b
Author: Bruno Oliveira nicoddemus@gmail.com
Date: Thu May 12 20:19:54 2016 -0300

Qt API lazy load in qt_compat and qt_api config option

Fix #129

I think that the problem is that now PyQt4 is loaded before setting the API version. This is a problems only for PyQt4 under python2, but unfortunatly I have it's a combination I have to provide.

For the moment I'll fix the required version to pytest-qt to <= 1.11. If I have I'll try to figure out the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions