From 7b6178728eb1c5770bdc7240ec476d70de887500 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 12 Jul 2017 18:28:41 -0300 Subject: [PATCH 1/2] Avoid using sudo for testing Trying to fix #177 --- .travis.yml | 3 ++- tox.ini | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9c603825..a6edbafc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,8 +39,9 @@ before_script: - sleep 1 script: - - sudo catchsegv coverage run --source=pytestqt setup.py test + - catchsegv coverage run --source=pytestqt -m pytest tests - sudo tox -e lint + - sudo chmod -R a+rw . after_success: - coveralls diff --git a/tox.ini b/tox.ini index 8b19c9bf..3995a15d 100644 --- a/tox.ini +++ b/tox.ini @@ -21,6 +21,7 @@ passenv=DISPLAY XAUTHORITY USER USERNAME [testenv:lint] basepython=python3.4 +usedevelop=true deps= pytest sphinx From 35ce2f62b2b8c258b514d30cada46c3352499985 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 12 Jul 2017 19:18:59 -0300 Subject: [PATCH 2/2] Add changelog for 2.1.2 --- CHANGELOG.rst | 145 ++++++++++++++++++++++++++------------------------ 1 file changed, 75 insertions(+), 70 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 37cad808..46c37b00 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,8 @@ +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 ----- @@ -64,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) @@ -152,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 @@ -167,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 @@ -194,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 @@ -217,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 `_ - 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 `_ + 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 @@ -249,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 @@ -268,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 @@ -286,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`_) @@ -320,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 @@ -328,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) @@ -356,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:: @@ -376,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