[Python-modules-commits] [pytest-qt] 01/09: New upstream version 2.1.2
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Thu Jul 13 09:55:04 UTC 2017
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository pytest-qt.
commit 03afafb65dd8ebab56efa7e1f7e8420d51007040
Author: Ghislain Antony Vaillant <ghisvail at gmail.com>
Date: Thu Jul 13 09:34:35 2017 +0100
New upstream version 2.1.2
---
.travis.yml | 61 ++++++++---------
CHANGELOG.rst | 150 ++++++++++++++++++++++-------------------
Manifest.in | 3 -
PKG-INFO | 8 +--
README.rst | 6 +-
docs/conf.py | 5 +-
pytest_qt.egg-info/PKG-INFO | 8 +--
pytest_qt.egg-info/SOURCES.txt | 1 -
pytestqt/_version.py | 2 +-
pytestqt/exceptions.py | 3 +-
pytestqt/qt_compat.py | 4 +-
tests/test_basics.py | 36 +++++++---
tox.ini | 3 +-
13 files changed, 156 insertions(+), 134 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index febef69..a6edbaf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,54 +1,54 @@
-language: python
+language: generic
sudo: required
dist: trusty
-python:
- - "2.7"
- - "3.4"
-
-virtualenv:
- system_site_packages: true
-
-matrix:
- exclude:
- - env: PYTEST_QT_API=pyqt5
- python: "2.7"
-
env:
- - PYTEST_QT_API=pyqt4
- - PYTEST_QT_API=pyqt4v2
- - PYTEST_QT_API=pyside
- - PYTEST_QT_API=pyqt5
+ - PYTEST_QT_API=pyqt4 PYTHON=python2.7
+ - PYTEST_QT_API=pyqt4v2 PYTHON=python2.7
+ - PYTEST_QT_API=pyside PYTHON=python2.7
+
+ - PYTEST_QT_API=pyqt4 PYTHON=python3.4
+ - PYTEST_QT_API=pyqt4v2 PYTHON=python3.4
+ - PYTEST_QT_API=pyside PYTHON=python3.4
+ - PYTEST_QT_API=pyqt5 PYTHON=python3.4
install:
- sudo apt-get update
- # Xvfb
- - sudo apt-get install -y xvfb
+ # Xvfb / window manager
+ - sudo apt-get install -y xvfb herbstluftwm
# Qt
- - python scripts/install-qt.py
+ - $PYTHON scripts/install-qt.py
+
+ # Pip (3.4 does not have it by default)
+ - wget https://bootstrap.pypa.io/get-pip.py
+ - sudo $PYTHON get-pip.py
- # PyTest
- - pip install -U pytest
+ # Dependencies
+ - sudo $PYTHON -m pip install -U pytest tox coveralls
- # Tox
- - pip install -U tox
+ # pytest-qt
+ - sudo $PYTHON setup.py develop
- # others
- - pip install coveralls --use-wheel
+before_script:
+ - "export DISPLAY=:99.0"
+ - start-stop-daemon --start --background --exec /usr/bin/Xvfb -- $DISPLAY -screen 0 1024x768x24
+ - sleep 3 # give xvfb some time to start
+ - "herbstluftwm &"
+ - sleep 1
script:
- - python setup.py develop
- # change screen size and depth in attempt to fix waitActive test (#160)
- - catchsegv xvfb-run --server-args="-screen 0 640x480x24" coverage run --source=pytestqt setup.py test
- - tox -e lint
+ - catchsegv coverage run --source=pytestqt -m pytest tests
+ - sudo tox -e lint
+ - sudo chmod -R a+rw .
after_success:
- coveralls
deploy:
provider: pypi
+ skip_upload_docs: true
user: nicoddemus
password:
secure: Uj4XhkIUGE8CkE9mbP4y2wrp1s+jODkEi+wXCL1ZDhcCxxs3gjEOtAlqIXS/4PMLZcxeV2rXNGzGJ6n+i6Ruj2T1wfar7hmy2faaur6tcUDhEpXLkAl6DAKlMiZbEyT4C7OpunBoYmw8Gh/3kaDeGgz4FxEiJakAqzEmmeyFvFY=
@@ -56,4 +56,5 @@ deploy:
tags: true
distributions: sdist bdist_wheel
repo: pytest-dev/pytest-qt
+ condition: $PYTEST_QT_API = pyqt5
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index ecc9cfe..46c37b0 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,3 +1,13 @@
+2.1.2
+-----
+
+- Fix issue where ``pytestqt`` was hiding the information when there's an exception raised from another exception on Python 3.
+
+2.1.1
+-----
+
+- Fixed tests on Python 3.6.
+
2.1
---
@@ -59,7 +69,7 @@ New Features
for ModelTester (`#63`_).
* New ``qtbot.waitUntil`` method, which continuously calls a callback until a condition
- is met or a timeout is reached. Useful for testing asynchronous features
+ is met or a timeout is reached. Useful for testing asynchronous features
(like in X window environments for example).
* ``waitSignal`` and ``waitSignals`` can receive an optional callback (or list of callbacks)
@@ -147,10 +157,10 @@ Other Changes
- ``qtbot`` now has a new ``wait`` method which does a blocking wait while the
event loop continues to run, similar to ``QTest::qWait``. Thanks
`@The-Compiler`_ for the PR (closes `107`_)!
-
+
- raise ``RuntimeError`` instead of ``ImportError`` when failing to import
- any Qt binding: raising the latter causes `pluggy` in `pytest-2.8` to
- generate a subtle warning instead of a full blown error.
+ any Qt binding: raising the latter causes `pluggy` in `pytest-2.8` to
+ generate a subtle warning instead of a full blown error.
Thanks `@Sheeo`_ for bringing this problem to attention (closes `109`_).
.. _105: https://github.com/pytest-dev/pytest-qt/issues/105
@@ -162,26 +172,26 @@ Other Changes
1.8.0
-----
-- ``pytest.mark.qt_log_ignore`` now supports an ``extend`` parameter that will extend
- the list of regexes used to ignore Qt messages (defaults to False).
+- ``pytest.mark.qt_log_ignore`` now supports an ``extend`` parameter that will extend
+ the list of regexes used to ignore Qt messages (defaults to False).
Thanks `@The-Compiler`_ for the PR (`99`_).
- Fixed internal error when interacting with other plugins that raise an error,
hiding the original exception (`98`_). Thanks `@The-Compiler`_ for the PR!
-
+
- Now ``pytest-qt`` is properly tested with PyQt5 on Travis-CI. Many thanks
to `@The-Compiler`_ for the PR!
-
+
.. _99: https://github.com/pytest-dev/pytest-qt/issues/99
.. _98: https://github.com/pytest-dev/pytest-qt/issues/98
1.7.0
-----
-- ``PYTEST_QT_API`` can now be set to ``pyqt4v2`` in order to use version 2 of the
+- ``PYTEST_QT_API`` can now be set to ``pyqt4v2`` in order to use version 2 of the
PyQt4 API. Thanks `@montefra`_ for the PR (`93`_)!
-
-.. _93: https://github.com/pytest-dev/pytest-qt/issues/93
+
+.. _93: https://github.com/pytest-dev/pytest-qt/issues/93
1.6.0
@@ -189,22 +199,22 @@ Other Changes
- Reduced verbosity when exceptions are captured in virtual methods
(`77`_, thanks `@The-Compiler`_).
-
+
- ``pytestqt.plugin`` has been split in several files (`74`_) and tests have been
moved out of the ``pytestqt`` package. This should not affect users, but it
is worth mentioning nonetheless.
- ``QApplication.processEvents()`` is now called before and after other fixtures
- and teardown hooks, to better try to avoid non-processed events from leaking
- from one test to the next. (67_, thanks `@The-Compiler`_).
+ and teardown hooks, to better try to avoid non-processed events from leaking
+ from one test to the next. (67_, thanks `@The-Compiler`_).
- Show Qt/PyQt/PySide versions in pytest header (68_, thanks `@The-Compiler`_!).
- Disconnect SignalBlocker functions after its loop exits to ensure second
- emissions that call the internal functions on the now-garbage-collected
+ emissions that call the internal functions on the now-garbage-collected
SignalBlocker instance (#69, thanks `@The-Compiler`_ for the PR).
-
-.. _77: https://github.com/pytest-dev/pytest-qt/issues/77
+
+.. _77: https://github.com/pytest-dev/pytest-qt/issues/77
.. _74: https://github.com/pytest-dev/pytest-qt/issues/74
.. _67: https://github.com/pytest-dev/pytest-qt/issues/67
.. _68: https://github.com/pytest-dev/pytest-qt/issues/68
@@ -212,31 +222,31 @@ Other Changes
1.5.1
-----
-- Exceptions are now captured also during test tear down, as delayed events will
- get processed then and might raise exceptions in virtual methods;
- this is specially problematic in ``PyQt5.5``, which
- `changed the behavior <http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#pyqt-v5-5>`_
- to call ``abort`` by default, which will crash the interpreter.
+- Exceptions are now captured also during test tear down, as delayed events will
+ get processed then and might raise exceptions in virtual methods;
+ this is specially problematic in ``PyQt5.5``, which
+ `changed the behavior <http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#pyqt-v5-5>`_
+ to call ``abort`` by default, which will crash the interpreter.
(65_, thanks `@The-Compiler`_).
-
-.. _65: https://github.com/pytest-dev/pytest-qt/issues/65
+
+.. _65: https://github.com/pytest-dev/pytest-qt/issues/65
1.5.0
-----
-- Fixed log line number in messages, and provide better contextual information
+- Fixed log line number in messages, and provide better contextual information
in Qt5 (55_, thanks `@The-Compiler`_);
-
-- Fixed issue where exceptions inside a ``waitSignals`` or ``waitSignal``
- with-statement block would be swallowed and a ``SignalTimeoutError`` would be
- raised instead. (59_, thanks `@The-Compiler`_ for bringing up the issue and
+
+- Fixed issue where exceptions inside a ``waitSignals`` or ``waitSignal``
+ with-statement block would be swallowed and a ``SignalTimeoutError`` would be
+ raised instead. (59_, thanks `@The-Compiler`_ for bringing up the issue and
providing a test case);
-
-- Fixed issue where the first usage of ``qapp`` fixture would return ``None``.
+
+- Fixed issue where the first usage of ``qapp`` fixture would return ``None``.
Thanks to `@gqmelo`_ for noticing and providing a PR;
-- New ``qtlog`` now sports a context manager method, ``disabled`` (58_).
+- New ``qtlog`` now sports a context manager method, ``disabled`` (58_).
Thanks `@The-Compiler`_ for the idea and testing;
-
+
.. _55: https://github.com/pytest-dev/pytest-qt/issues/55
.. _58: https://github.com/pytest-dev/pytest-qt/issues/58
.. _59: https://github.com/pytest-dev/pytest-qt/issues/59
@@ -244,18 +254,18 @@ Other Changes
1.4.0
-----
-- Messages sent by ``qDebug``, ``qWarning``, ``qCritical`` are captured and displayed
- when tests fail, similar to `pytest-catchlog`_. Also, tests
- can be configured to automatically fail if an unexpected message is generated.
-
-- New method ``waitSignals``: will block untill **all** signals given are
+- Messages sent by ``qDebug``, ``qWarning``, ``qCritical`` are captured and displayed
+ when tests fail, similar to `pytest-catchlog`_. Also, tests
+ can be configured to automatically fail if an unexpected message is generated.
+
+- New method ``waitSignals``: will block untill **all** signals given are
triggered (thanks `@The-Compiler`_ for idea and complete PR).
-
-- New parameter ``raising`` to ``waitSignals`` and ``waitSignals``: when ``True``
- will raise a ``qtbot.SignalTimeoutError`` exception when
- timeout is reached (defaults to ``False``).
+
+- New parameter ``raising`` to ``waitSignals`` and ``waitSignals``: when ``True``
+ will raise a ``qtbot.SignalTimeoutError`` exception when
+ timeout is reached (defaults to ``False``).
(thanks again to `@The-Compiler`_ for idea and complete PR).
-
+
- ``pytest-qt`` now requires ``pytest`` version >= 2.7.
.. _pytest-catchlog: https://pypi.python.org/pypi/pytest-catchlog
@@ -263,17 +273,17 @@ Other Changes
Internal changes to improve memory management
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ``QApplication.exit()`` is no longer called at the end of the test session
+- ``QApplication.exit()`` is no longer called at the end of the test session
and the ``QApplication`` instance is not garbage collected anymore;
-
-- ``QtBot`` no longer receives a QApplication as a parameter in the
- constructor, always referencing ``QApplication.instance()`` now; this avoids
+
+- ``QtBot`` no longer receives a QApplication as a parameter in the
+ constructor, always referencing ``QApplication.instance()`` now; this avoids
keeping an extra reference in the ``qtbot`` instances.
-
-- ``deleteLater`` is called on widgets added in ``QtBot.addWidget`` at the end
+
+- ``deleteLater`` is called on widgets added in ``QtBot.addWidget`` at the end
of each test;
-
-- ``QApplication.processEvents()`` is called at the end of each test to
+
+- ``QApplication.processEvents()`` is called at the end of each test to
make sure widgets are cleaned up;
1.3.0
@@ -281,29 +291,29 @@ Internal changes to improve memory management
- pytest-qt now supports `PyQt5`_!
- Which Qt api will be used is still detected automatically, but you can choose
- one using the ``PYTEST_QT_API`` environment variable
+ Which Qt api will be used is still detected automatically, but you can choose
+ one using the ``PYTEST_QT_API`` environment variable
(the old ``PYTEST_QT_FORCE_PYQT`` is still supported for backward compatibility).
Many thanks to `@jdreaver`_ for helping to test this release!
-
-.. _PyQt5: http://pyqt.sourceforge.net/Docs/PyQt5/introduction.html
+
+.. _PyQt5: http://pyqt.sourceforge.net/Docs/PyQt5/introduction.html
1.2.3
-----
-- Now the module ````qt_compat```` no longer sets ``QString`` and ``QVariant`` APIs to
- ``2`` for PyQt, making it compatible for those still using version ``1`` of the
+- Now the module ````qt_compat```` no longer sets ``QString`` and ``QVariant`` APIs to
+ ``2`` for PyQt, making it compatible for those still using version ``1`` of the
API.
-
+
1.2.2
-----
-- Now it is possible to disable automatic exception capture by using markers or
- a ``pytest.ini`` option. Consult the documentation for more information.
+- Now it is possible to disable automatic exception capture by using markers or
+ a ``pytest.ini`` option. Consult the documentation for more information.
(`26`_, thanks `@datalyze-solutions`_ for bringing this up).
-
-- ``QApplication`` instance is created only if it wasn't created yet
+
+- ``QApplication`` instance is created only if it wasn't created yet
(`21`_, thanks `@fabioz`_!)
- ``addWidget`` now keeps a weak reference its widgets (`20`_, thanks `@fabioz`_)
@@ -315,7 +325,7 @@ Internal changes to improve memory management
1.2.1
-----
-- Fixed 16_: a signal emitted immediately inside a ``waitSignal`` block now
+- Fixed 16_: a signal emitted immediately inside a ``waitSignal`` block now
works as expected (thanks `@baudren`_).
.. _16: https://github.com/pytest-dev/pytest-qt/issues/16
@@ -323,21 +333,21 @@ Internal changes to improve memory management
1.2.0
-----
-This version include the new ``waitSignal`` function, which makes it easy
-to write tests for long running computations that happen in other threads
+This version include the new ``waitSignal`` function, which makes it easy
+to write tests for long running computations that happen in other threads
or processes:
.. code-block:: python
def test_long_computation(qtbot):
app = Application()
-
+
# Watch for the app.worker.finished signal, then start the worker.
with qtbot.waitSignal(app.worker.finished, timeout=10000) as blocker:
blocker.connect(app.worker.failed) # Can add other signals to blocker
app.worker.start()
# Test will wait here until either signal is emitted, or 10 seconds has elapsed
-
+
assert blocker.signal_triggered # Assuming the work took less than 10 seconds
assert_application_results(app)
@@ -351,8 +361,8 @@ Many thanks to `@jdreaver`_ for discussion and complete PR! (`12`_, `13`_)
- Added ``stop`` as an alias for ``stopForInteraction`` (`10`_, thanks `@itghisi`_)
-- Now exceptions raised in virtual methods make tests fail, instead of silently
- passing (`11`_). If an exception is raised, the test will fail and it exceptions
+- Now exceptions raised in virtual methods make tests fail, instead of silently
+ passing (`11`_). If an exception is raised, the test will fail and it exceptions
that happened inside virtual calls will be printed as such::
@@ -371,7 +381,7 @@ Many thanks to `@jdreaver`_ for discussion and complete PR! (`12`_, `13`_)
Thanks to `@jdreaver`_ for request and sample code!
-- Fixed documentation for ``QtBot``: it was not being rendered in the
+- Fixed documentation for ``QtBot``: it was not being rendered in the
docs due to an import error.
.. _10: https://github.com/pytest-dev/pytest-qt/issues/10
diff --git a/Manifest.in b/Manifest.in
deleted file mode 100644
index 078d55d..0000000
--- a/Manifest.in
+++ /dev/null
@@ -1,3 +0,0 @@
-include LICENSE
-include README.rst
-include tox.ini
diff --git a/PKG-INFO b/PKG-INFO
index 349d0b2..01a6584 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pytest-qt
-Version: 2.1.0
+Version: 2.1.2
Summary: pytest support for PyQt and PySide applications
Home-page: http://github.com/pytest-dev/pytest-qt
Author: Bruno Oliveira
@@ -39,8 +39,8 @@ Description: =========
.. |version| image:: http://img.shields.io/pypi/v/pytest-qt.svg
:target: https://pypi.python.org/pypi/pytest-qt
- .. |downloads| image:: http://img.shields.io/pypi/dm/pytest-qt.svg
- :target: https://pypi.python.org/pypi/pytest-qt
+ .. |anaconda| image:: https://anaconda.org/conda-forge/pytest-qt/badges/version.svg
+ :target: https://anaconda.org/conda-forge/pytest-qt
.. |travis| image:: https://img.shields.io/travis/pytest-dev/pytest-qt/master.svg
:target: https://travis-ci.org/pytest-dev/pytest-qt
@@ -58,7 +58,7 @@ Description: =========
:target: https://pypi.python.org/pypi/pytest-qt/
:alt: Supported Python versions
- |python| |version| |downloads| |travis| |appveyor| |coverage| |docs|
+ |python| |version| |anaconda| |travis| |appveyor| |coverage| |docs|
Features
diff --git a/README.rst b/README.rst
index e4fec66..1185a52 100644
--- a/README.rst
+++ b/README.rst
@@ -31,8 +31,8 @@ This allows you to test and make sure your view layer is behaving the way you ex
.. |version| image:: http://img.shields.io/pypi/v/pytest-qt.svg
:target: https://pypi.python.org/pypi/pytest-qt
-.. |downloads| image:: http://img.shields.io/pypi/dm/pytest-qt.svg
- :target: https://pypi.python.org/pypi/pytest-qt
+.. |anaconda| image:: https://anaconda.org/conda-forge/pytest-qt/badges/version.svg
+ :target: https://anaconda.org/conda-forge/pytest-qt
.. |travis| image:: https://img.shields.io/travis/pytest-dev/pytest-qt/master.svg
:target: https://travis-ci.org/pytest-dev/pytest-qt
@@ -50,7 +50,7 @@ This allows you to test and make sure your view layer is behaving the way you ex
:target: https://pypi.python.org/pypi/pytest-qt/
:alt: Supported Python versions
-|python| |version| |downloads| |travis| |appveyor| |coverage| |docs|
+|python| |version| |anaconda| |travis| |appveyor| |coverage| |docs|
Features
diff --git a/docs/conf.py b/docs/conf.py
index 7dae585..cfc1bd3 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -46,9 +46,8 @@ copyright = u'2013, Bruno Oliveira'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
-#
-import pkg_resources
-version = pkg_resources.get_distribution('pytest-qt').version
+from pytestqt import version
+
# The short X.Y version.
# The full version, including alpha/beta/rc tags.
diff --git a/pytest_qt.egg-info/PKG-INFO b/pytest_qt.egg-info/PKG-INFO
index 349d0b2..01a6584 100644
--- a/pytest_qt.egg-info/PKG-INFO
+++ b/pytest_qt.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: pytest-qt
-Version: 2.1.0
+Version: 2.1.2
Summary: pytest support for PyQt and PySide applications
Home-page: http://github.com/pytest-dev/pytest-qt
Author: Bruno Oliveira
@@ -39,8 +39,8 @@ Description: =========
.. |version| image:: http://img.shields.io/pypi/v/pytest-qt.svg
:target: https://pypi.python.org/pypi/pytest-qt
- .. |downloads| image:: http://img.shields.io/pypi/dm/pytest-qt.svg
- :target: https://pypi.python.org/pypi/pytest-qt
+ .. |anaconda| image:: https://anaconda.org/conda-forge/pytest-qt/badges/version.svg
+ :target: https://anaconda.org/conda-forge/pytest-qt
.. |travis| image:: https://img.shields.io/travis/pytest-dev/pytest-qt/master.svg
:target: https://travis-ci.org/pytest-dev/pytest-qt
@@ -58,7 +58,7 @@ Description: =========
:target: https://pypi.python.org/pypi/pytest-qt/
:alt: Supported Python versions
- |python| |version| |downloads| |travis| |appveyor| |coverage| |docs|
+ |python| |version| |anaconda| |travis| |appveyor| |coverage| |docs|
Features
diff --git a/pytest_qt.egg-info/SOURCES.txt b/pytest_qt.egg-info/SOURCES.txt
index 6173719..0b39955 100644
--- a/pytest_qt.egg-info/SOURCES.txt
+++ b/pytest_qt.egg-info/SOURCES.txt
@@ -5,7 +5,6 @@
.travis.yml
CHANGELOG.rst
LICENSE
-Manifest.in
README.rst
appveyor.yml
requirements.txt
diff --git a/pytestqt/_version.py b/pytestqt/_version.py
index 7400f1c..cde4617 100644
--- a/pytestqt/_version.py
+++ b/pytestqt/_version.py
@@ -1,4 +1,4 @@
# coding: utf-8
# file generated by setuptools_scm
# don't change, don't track in version control
-version = '2.1.0'
+version = '2.1.2'
diff --git a/pytestqt/exceptions.py b/pytestqt/exceptions.py
index ef02dbe..d820cfd 100644
--- a/pytestqt/exceptions.py
+++ b/pytestqt/exceptions.py
@@ -70,8 +70,7 @@ def format_captured_exceptions(exceptions):
message = 'Qt exceptions in virtual methods:\n'
message += '_' * 80 + '\n'
for (exc_type, value, tback) in exceptions:
- message += ''.join(traceback.format_tb(tback)) + '\n'
- message += '%s: %s\n' % (exc_type.__name__, value)
+ message += ''.join(traceback.format_exception(exc_type, value, tback)) + '\n'
message += '_' * 80 + '\n'
return message
diff --git a/pytestqt/qt_compat.py b/pytestqt/qt_compat.py
index 3dd6b46..796ebaa 100644
--- a/pytestqt/qt_compat.py
+++ b/pytestqt/qt_compat.py
@@ -31,7 +31,7 @@ class _QtApi:
api = api.lower()
if api not in ('pyside', 'pyqt4', 'pyqt4v2', 'pyqt5'): # pragma: no cover
msg = 'Invalid value for $PYTEST_QT_API: %s'
- raise RuntimeError(msg % qt_api)
+ raise RuntimeError(msg % api)
return api
def _guess_qt_api(self): # pragma: no cover
@@ -106,7 +106,6 @@ class _QtApi:
self.Property = QtCore.Property
self.QApplication = QtGui.QApplication
self.QWidget = QtGui.QWidget
- self.QLineEdit = QtGui.QLineEdit
self.QStringListModel = QtGui.QStringListModel
self.qInstallMsgHandler = QtCore.qInstallMsgHandler
@@ -137,7 +136,6 @@ class _QtApi:
_QtWidgets = _import_module('QtWidgets')
self.QApplication = _QtWidgets.QApplication
self.QWidget = _QtWidgets.QWidget
- self.QLineEdit = _QtWidgets.QLineEdit
self.qInstallMessageHandler = QtCore.qInstallMessageHandler
self.QStringListModel = QtCore.QStringListModel
diff --git a/tests/test_basics.py b/tests/test_basics.py
index 0464cb8..fddac5c 100644
--- a/tests/test_basics.py
+++ b/tests/test_basics.py
@@ -84,16 +84,11 @@ def test_wait_window(show, method_name, qtbot):
pass
assert str(exc_info.value) == 'Available in PyQt5 only'
else:
- widget = qt_api.QLineEdit()
+ widget = qt_api.QWidget()
qtbot.add_widget(widget)
if show:
with method(widget, timeout=1000):
- widget.move(100, 100)
- widget.resize(100, 100)
- widget.setFocus()
widget.show()
- if 'TRAVIS' in os.environ and method_name == 'waitActive':
- pytest.xfail('skipping this check on travis, see #160')
else:
with pytest.raises(qtbot.TimeoutError):
with method(widget, timeout=100):
@@ -354,7 +349,30 @@ def test_qt_api_ini_config(testdir, option_api):
'* 1 passed in *'
])
else:
- result.stderr.fnmatch_lines([
- '*ImportError:*'
- ])
+ try:
+ ModuleNotFoundError
+ except NameError:
+ # Python < 3.6
+ result.stderr.fnmatch_lines([
+ '*ImportError:*'
+ ])
+ else:
+ # Python >= 3.6
+ result.stderr.fnmatch_lines([
+ '*ModuleNotFoundError:*'
+ ])
+
+
+def test_invalid_qt_api_envvar(testdir, monkeypatch):
+ """
+ Make sure the error message with an invalid PYQTEST_QT_API is correct.
+ """
+ testdir.makepyfile('''
+ import pytest
+ def test_foo(qtbot):
+ pass
+ ''')
+ monkeypatch.setenv('PYTEST_QT_API', 'piecute')
+ result = testdir.runpytest_subprocess()
+ result.stderr.fnmatch_lines(['* Invalid value for $PYTEST_QT_API: piecute'])
diff --git a/tox.ini b/tox.ini
index 9f73858..3995a15 100644
--- a/tox.ini
+++ b/tox.ini
@@ -20,7 +20,8 @@ setenv=
passenv=DISPLAY XAUTHORITY USER USERNAME
[testenv:lint]
-basepython=python3.5
+basepython=python3.4
+usedevelop=true
deps=
pytest
sphinx
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/pytest-qt.git
More information about the Python-modules-commits
mailing list