Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-timeout for openSUSE:Factory checked in at 2022-01-07 12:45:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-timeout (Old) and /work/SRC/openSUSE:Factory/.python-pytest-timeout.new.1896 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-timeout" Fri Jan 7 12:45:17 2022 rev:11 rq:944139 version:2.0.2 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-timeout/python-pytest-timeout.changes 2020-11-09 13:56:49.088041741 +0100 +++ /work/SRC/openSUSE:Factory/.python-pytest-timeout.new.1896/python-pytest-timeout.changes 2022-01-07 12:46:02.235831126 +0100 @@ -1,0 +2,13 @@ +Thu Jan 6 01:39:29 UTC 2022 - Steve Kowalik <steven.kowa...@suse.com> + +- Update to 2.0.2: + * Fix debugger detection on OSX, thanks Alexander Pacha. + * Fix Python 2 removal, thanks Nicusor Picatureanu. + * Increase pytest requirement to >=5.0.0. Thanks Dominic Davis-Foster. + * Use thread timeout method when plugin is not called from main thread + to avoid crash. + * Fix pycharm debugger detection so timeouts are not triggered during + debugger usage. + * Dropped support for Python 2, minimum pytest version upported is 5.0.0. + +------------------------------------------------------------------- Old: ---- pytest-timeout-1.4.2.tar.gz New: ---- pytest-timeout-2.0.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-timeout.spec ++++++ --- /var/tmp/diff_new_pack.hooCBf/_old 2022-01-07 12:46:02.879831573 +0100 +++ /var/tmp/diff_new_pack.hooCBf/_new 2022-01-07 12:46:02.879831573 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-pytest-timeout # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,20 +17,21 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python2 1 Name: python-pytest-timeout -Version: 1.4.2 +Version: 2.0.2 Release: 0 Summary: Pytest plugin to abort hanging tests License: MIT URL: https://github.com/pytest-dev/pytest-timeout/ Source: https://files.pythonhosted.org/packages/source/p/pytest-timeout/pytest-timeout-%{version}.tar.gz BuildRequires: %{python_module pexpect} -BuildRequires: %{python_module pytest >= 3.6.0} +BuildRequires: %{python_module pytest >= 5.0.0} BuildRequires: %{python_module pytest-cov} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros -Requires: python-pytest >= 3.6.0 +Requires: python-pytest >= 5.0.0 BuildArch: noarch %python_subpackages ++++++ pytest-timeout-1.4.2.tar.gz -> pytest-timeout-2.0.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/PKG-INFO new/pytest-timeout-2.0.2/PKG-INFO --- old/pytest-timeout-1.4.2/PKG-INFO 2020-07-15 21:25:23.076116000 +0200 +++ new/pytest-timeout-2.0.2/PKG-INFO 2021-12-13 20:32:59.685103200 +0100 @@ -1,8 +1,8 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: pytest-timeout -Version: 1.4.2 -Summary: py.test plugin to abort hanging tests -Home-page: http://github.com/pytest-dev/pytest-timeout/ +Version: 2.0.2 +Summary: pytest plugin to abort hanging tests +Home-page: https://github.com/pytest-dev/pytest-timeout Author: Floris Bruynooghe Author-email: f...@devork.be License: MIT @@ -24,19 +24,20 @@ .. |python| image:: https://img.shields.io/pypi/pyversions/pytest-timeout.svg :target: https://pypi.python.org/pypi/pytest-timeout/ - This is a plugin which will terminate tests after a certain timeout, - assuming the test session isn't being debugged. When aborting a test - it will show a stack dump of all threads running at the time. - This is useful when running tests under a continuous - integration server or simply if you don't know why the test suite hangs. + **This is not the timeout you are looking for!** - .. note:: + .. warning:: - The way this plugin detects whether or not a debugging session is - active is by checking if a trace function is set and if one is, it - check to see if the module it belongs to is present in a set of - known debugging frameworks modules OR if pytest itself drops you - into a pbd session. + Please read this README carefully and only use this plugin if you + understand the consequences. Remember your test suite needs to be + **fast**, timeouts are a last resort not an expected failure mode. + + This plugin will time each test and terminate it when it takes too + long. Termination may or may not be graceful, please see below, but + when aborting it will show a stack dump of all thread running at the + time. This is useful when running tests under a continuous + integration server or simply if you don't know why the test suite + hangs. .. note:: @@ -50,9 +51,8 @@ stage. See below for detailed information on the timeout methods and their side-effects. - The pytest-timeout plugin has been tested on python 2.7 or higher, - including 3.X, pypy and pypy3. See tox.ini for currently tested - versions. + The pytest-timeout plugin has been tested on Python 3.6 and higher, + including PyPy3. See tox.ini for currently tested versions. Usage @@ -62,12 +62,17 @@ pip install pytest-timeout - Now you can run tests using a timeout, in seconds, after which they - will be terminated:: + Now you can run the test suite while setting a timeout in seconds, any + individual test which takes longer than the given duration will be + terminated:: pytest --timeout=300 - Alternatively you can mark individual tests as having a timeout:: + Furthermore you can also use a decorator to set the timeout for an + individual test. If combined with the ``--timeout`` flag this will + override the timeout for this individual test: + + .. code:: python @pytest.mark.timeout(60) def test_foo(): @@ -79,7 +84,9 @@ defined in a number of ways, from low to high priority: 1. You can set a global timeout in the `pytest configuration file`__ - using the ``timeout`` option. E.g.:: + using the ``timeout`` option. E.g.: + + .. code:: ini [pytest] timeout = 300 @@ -91,7 +98,9 @@ overriding both the environment variable and configuration option. 4. Using the ``timeout`` marker_ on test items you can specify - timeouts on a per-item basis:: + timeouts on a per-item basis: + + .. code:: python @pytest.mark.timeout(300) def test_foo(): @@ -145,8 +154,8 @@ If the system supports the SIGALRM signal the *signal* method will be used by default. This method schedules an alarm when the test item - starts and cancels it when it finishes. If the alarm expires during - the test the signal handler will dump the stack of any other threads + starts and cancels the alarm when the test finishes. If the alarm expires + during the test the signal handler will dump the stack of any other threads running to stderr and use ``pytest.fail()`` to interrupt the test. The benefit of this method is that the pytest process is not @@ -164,9 +173,11 @@ option in the `pytest configuration file`__, the ``--timeout_method`` command line parameter or the ``timeout`` marker_. Simply set their value to the string ``thread`` or ``signal`` to override the default - method. On a marker this is done using the ``method`` keyword:: + method. On a marker this is done using the ``method`` keyword: + + .. code:: python - @pytest.mark.timeout(method='thread') + @pytest.mark.timeout(method="thread") def test_foo(): pass @@ -177,7 +188,9 @@ The ``timeout`` Marker API ========================== - The full signature of the timeout marker is:: + The full signature of the timeout marker is: + + .. code:: python pytest.mark.timeout(timeout=0, method=DEFAULT_METHOD) @@ -205,10 +218,56 @@ case of doubt the thread method which terminates the entire process might result in clearer output. + Avoiding timeouts in Fixtures + ============================= + + The timeout applies to the entire test including any fixtures which + may need to be setup or torn down for the test (the exact affected + fixtures depends on which scope they are and whether other tests will + still use the same fixture). If the timeouts really are too short to + include fixture durations, firstly make the timeouts larger ;). If + this really isn't an option a ``timeout_func_only`` boolean setting + exists which can be set in the pytest ini configuration file, as + documented in ``pytest --help``. + + + Debugger Detection + ================== + + This plugin tries to avoid triggering the timeout when a debugger is + detected. This is mostly a convenience so you do not need to remember + to disable the timeout when interactively debugging. + + The way this plugin detects whether or not a debugging session is + active is by checking if a trace function is set and if one is, it + check to see if the module it belongs to is present in a set of known + debugging frameworks modules OR if pytest itself drops you into a pdb + session using ``--pdb`` or similar. + Changelog ========= + 2.0.2 + ----- + + - Fix debugger detection on OSX, thanks Alexander Pacha. + + 2.0.1 + ----- + + - Fix Python 2 removal, thanks Nicusor Picatureanu. + + 2.0.0 + ----- + + - Increase pytest requirement to >=5.0.0. Thanks Dominic Davis-Foster. + - Use thread timeout method when plugin is not called from main + thread to avoid crash. + - Fix pycharm debugger detection so timeouts are not triggered during + debugger usage. + - Dropped support for Python 2, minimum pytest version upported is 5.0.0. + 1.4.2 ----- @@ -352,10 +411,15 @@ Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Software Development :: Testing +Classifier: Framework :: Pytest +Requires-Python: >=3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/README.rst new/pytest-timeout-2.0.2/README.rst --- old/pytest-timeout-1.4.2/README.rst 2020-07-15 21:24:43.000000000 +0200 +++ new/pytest-timeout-2.0.2/README.rst 2021-12-13 20:27:58.000000000 +0100 @@ -16,19 +16,20 @@ .. |python| image:: https://img.shields.io/pypi/pyversions/pytest-timeout.svg :target: https://pypi.python.org/pypi/pytest-timeout/ -This is a plugin which will terminate tests after a certain timeout, -assuming the test session isn't being debugged. When aborting a test -it will show a stack dump of all threads running at the time. -This is useful when running tests under a continuous -integration server or simply if you don't know why the test suite hangs. +**This is not the timeout you are looking for!** -.. note:: +.. warning:: - The way this plugin detects whether or not a debugging session is - active is by checking if a trace function is set and if one is, it - check to see if the module it belongs to is present in a set of - known debugging frameworks modules OR if pytest itself drops you - into a pbd session. + Please read this README carefully and only use this plugin if you + understand the consequences. Remember your test suite needs to be + **fast**, timeouts are a last resort not an expected failure mode. + +This plugin will time each test and terminate it when it takes too +long. Termination may or may not be graceful, please see below, but +when aborting it will show a stack dump of all thread running at the +time. This is useful when running tests under a continuous +integration server or simply if you don't know why the test suite +hangs. .. note:: @@ -42,9 +43,8 @@ stage. See below for detailed information on the timeout methods and their side-effects. -The pytest-timeout plugin has been tested on python 2.7 or higher, -including 3.X, pypy and pypy3. See tox.ini for currently tested -versions. +The pytest-timeout plugin has been tested on Python 3.6 and higher, +including PyPy3. See tox.ini for currently tested versions. Usage @@ -54,12 +54,17 @@ pip install pytest-timeout -Now you can run tests using a timeout, in seconds, after which they -will be terminated:: +Now you can run the test suite while setting a timeout in seconds, any +individual test which takes longer than the given duration will be +terminated:: pytest --timeout=300 -Alternatively you can mark individual tests as having a timeout:: +Furthermore you can also use a decorator to set the timeout for an +individual test. If combined with the ``--timeout`` flag this will +override the timeout for this individual test: + +.. code:: python @pytest.mark.timeout(60) def test_foo(): @@ -71,7 +76,9 @@ defined in a number of ways, from low to high priority: 1. You can set a global timeout in the `pytest configuration file`__ - using the ``timeout`` option. E.g.:: + using the ``timeout`` option. E.g.: + + .. code:: ini [pytest] timeout = 300 @@ -83,7 +90,9 @@ overriding both the environment variable and configuration option. 4. Using the ``timeout`` marker_ on test items you can specify - timeouts on a per-item basis:: + timeouts on a per-item basis: + + .. code:: python @pytest.mark.timeout(300) def test_foo(): @@ -137,8 +146,8 @@ If the system supports the SIGALRM signal the *signal* method will be used by default. This method schedules an alarm when the test item -starts and cancels it when it finishes. If the alarm expires during -the test the signal handler will dump the stack of any other threads +starts and cancels the alarm when the test finishes. If the alarm expires +during the test the signal handler will dump the stack of any other threads running to stderr and use ``pytest.fail()`` to interrupt the test. The benefit of this method is that the pytest process is not @@ -156,9 +165,11 @@ option in the `pytest configuration file`__, the ``--timeout_method`` command line parameter or the ``timeout`` marker_. Simply set their value to the string ``thread`` or ``signal`` to override the default -method. On a marker this is done using the ``method`` keyword:: +method. On a marker this is done using the ``method`` keyword: + +.. code:: python - @pytest.mark.timeout(method='thread') + @pytest.mark.timeout(method="thread") def test_foo(): pass @@ -169,7 +180,9 @@ The ``timeout`` Marker API ========================== -The full signature of the timeout marker is:: +The full signature of the timeout marker is: + +.. code:: python pytest.mark.timeout(timeout=0, method=DEFAULT_METHOD) @@ -197,10 +210,56 @@ case of doubt the thread method which terminates the entire process might result in clearer output. +Avoiding timeouts in Fixtures +============================= + +The timeout applies to the entire test including any fixtures which +may need to be setup or torn down for the test (the exact affected +fixtures depends on which scope they are and whether other tests will +still use the same fixture). If the timeouts really are too short to +include fixture durations, firstly make the timeouts larger ;). If +this really isn't an option a ``timeout_func_only`` boolean setting +exists which can be set in the pytest ini configuration file, as +documented in ``pytest --help``. + + +Debugger Detection +================== + +This plugin tries to avoid triggering the timeout when a debugger is +detected. This is mostly a convenience so you do not need to remember +to disable the timeout when interactively debugging. + +The way this plugin detects whether or not a debugging session is +active is by checking if a trace function is set and if one is, it +check to see if the module it belongs to is present in a set of known +debugging frameworks modules OR if pytest itself drops you into a pdb +session using ``--pdb`` or similar. + Changelog ========= +2.0.2 +----- + +- Fix debugger detection on OSX, thanks Alexander Pacha. + +2.0.1 +----- + +- Fix Python 2 removal, thanks Nicusor Picatureanu. + +2.0.0 +----- + +- Increase pytest requirement to >=5.0.0. Thanks Dominic Davis-Foster. +- Use thread timeout method when plugin is not called from main + thread to avoid crash. +- Fix pycharm debugger detection so timeouts are not triggered during + debugger usage. +- Dropped support for Python 2, minimum pytest version upported is 5.0.0. + 1.4.2 ----- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/failure_demo.py new/pytest-timeout-2.0.2/failure_demo.py --- old/pytest-timeout-1.4.2/failure_demo.py 2020-06-14 14:15:17.000000000 +0200 +++ new/pytest-timeout-2.0.2/failure_demo.py 2021-07-18 21:06:35.000000000 +0200 @@ -1,8 +1,8 @@ """Demonstration of timeout failures using pytest_timeout. -To use this demo, invoke py.test on it:: +To use this demo, invoke pytest on it:: - py.test failure_demo.py + pytest failure_demo.py """ import threading import time diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/pytest_timeout.egg-info/PKG-INFO new/pytest-timeout-2.0.2/pytest_timeout.egg-info/PKG-INFO --- old/pytest-timeout-1.4.2/pytest_timeout.egg-info/PKG-INFO 2020-07-15 21:25:23.000000000 +0200 +++ new/pytest-timeout-2.0.2/pytest_timeout.egg-info/PKG-INFO 2021-12-13 20:32:59.000000000 +0100 @@ -1,8 +1,8 @@ -Metadata-Version: 1.1 +Metadata-Version: 1.2 Name: pytest-timeout -Version: 1.4.2 -Summary: py.test plugin to abort hanging tests -Home-page: http://github.com/pytest-dev/pytest-timeout/ +Version: 2.0.2 +Summary: pytest plugin to abort hanging tests +Home-page: https://github.com/pytest-dev/pytest-timeout Author: Floris Bruynooghe Author-email: f...@devork.be License: MIT @@ -24,19 +24,20 @@ .. |python| image:: https://img.shields.io/pypi/pyversions/pytest-timeout.svg :target: https://pypi.python.org/pypi/pytest-timeout/ - This is a plugin which will terminate tests after a certain timeout, - assuming the test session isn't being debugged. When aborting a test - it will show a stack dump of all threads running at the time. - This is useful when running tests under a continuous - integration server or simply if you don't know why the test suite hangs. + **This is not the timeout you are looking for!** - .. note:: + .. warning:: - The way this plugin detects whether or not a debugging session is - active is by checking if a trace function is set and if one is, it - check to see if the module it belongs to is present in a set of - known debugging frameworks modules OR if pytest itself drops you - into a pbd session. + Please read this README carefully and only use this plugin if you + understand the consequences. Remember your test suite needs to be + **fast**, timeouts are a last resort not an expected failure mode. + + This plugin will time each test and terminate it when it takes too + long. Termination may or may not be graceful, please see below, but + when aborting it will show a stack dump of all thread running at the + time. This is useful when running tests under a continuous + integration server or simply if you don't know why the test suite + hangs. .. note:: @@ -50,9 +51,8 @@ stage. See below for detailed information on the timeout methods and their side-effects. - The pytest-timeout plugin has been tested on python 2.7 or higher, - including 3.X, pypy and pypy3. See tox.ini for currently tested - versions. + The pytest-timeout plugin has been tested on Python 3.6 and higher, + including PyPy3. See tox.ini for currently tested versions. Usage @@ -62,12 +62,17 @@ pip install pytest-timeout - Now you can run tests using a timeout, in seconds, after which they - will be terminated:: + Now you can run the test suite while setting a timeout in seconds, any + individual test which takes longer than the given duration will be + terminated:: pytest --timeout=300 - Alternatively you can mark individual tests as having a timeout:: + Furthermore you can also use a decorator to set the timeout for an + individual test. If combined with the ``--timeout`` flag this will + override the timeout for this individual test: + + .. code:: python @pytest.mark.timeout(60) def test_foo(): @@ -79,7 +84,9 @@ defined in a number of ways, from low to high priority: 1. You can set a global timeout in the `pytest configuration file`__ - using the ``timeout`` option. E.g.:: + using the ``timeout`` option. E.g.: + + .. code:: ini [pytest] timeout = 300 @@ -91,7 +98,9 @@ overriding both the environment variable and configuration option. 4. Using the ``timeout`` marker_ on test items you can specify - timeouts on a per-item basis:: + timeouts on a per-item basis: + + .. code:: python @pytest.mark.timeout(300) def test_foo(): @@ -145,8 +154,8 @@ If the system supports the SIGALRM signal the *signal* method will be used by default. This method schedules an alarm when the test item - starts and cancels it when it finishes. If the alarm expires during - the test the signal handler will dump the stack of any other threads + starts and cancels the alarm when the test finishes. If the alarm expires + during the test the signal handler will dump the stack of any other threads running to stderr and use ``pytest.fail()`` to interrupt the test. The benefit of this method is that the pytest process is not @@ -164,9 +173,11 @@ option in the `pytest configuration file`__, the ``--timeout_method`` command line parameter or the ``timeout`` marker_. Simply set their value to the string ``thread`` or ``signal`` to override the default - method. On a marker this is done using the ``method`` keyword:: + method. On a marker this is done using the ``method`` keyword: + + .. code:: python - @pytest.mark.timeout(method='thread') + @pytest.mark.timeout(method="thread") def test_foo(): pass @@ -177,7 +188,9 @@ The ``timeout`` Marker API ========================== - The full signature of the timeout marker is:: + The full signature of the timeout marker is: + + .. code:: python pytest.mark.timeout(timeout=0, method=DEFAULT_METHOD) @@ -205,10 +218,56 @@ case of doubt the thread method which terminates the entire process might result in clearer output. + Avoiding timeouts in Fixtures + ============================= + + The timeout applies to the entire test including any fixtures which + may need to be setup or torn down for the test (the exact affected + fixtures depends on which scope they are and whether other tests will + still use the same fixture). If the timeouts really are too short to + include fixture durations, firstly make the timeouts larger ;). If + this really isn't an option a ``timeout_func_only`` boolean setting + exists which can be set in the pytest ini configuration file, as + documented in ``pytest --help``. + + + Debugger Detection + ================== + + This plugin tries to avoid triggering the timeout when a debugger is + detected. This is mostly a convenience so you do not need to remember + to disable the timeout when interactively debugging. + + The way this plugin detects whether or not a debugging session is + active is by checking if a trace function is set and if one is, it + check to see if the module it belongs to is present in a set of known + debugging frameworks modules OR if pytest itself drops you into a pdb + session using ``--pdb`` or similar. + Changelog ========= + 2.0.2 + ----- + + - Fix debugger detection on OSX, thanks Alexander Pacha. + + 2.0.1 + ----- + + - Fix Python 2 removal, thanks Nicusor Picatureanu. + + 2.0.0 + ----- + + - Increase pytest requirement to >=5.0.0. Thanks Dominic Davis-Foster. + - Use thread timeout method when plugin is not called from main + thread to avoid crash. + - Fix pycharm debugger detection so timeouts are not triggered during + debugger usage. + - Dropped support for Python 2, minimum pytest version upported is 5.0.0. + 1.4.2 ----- @@ -352,10 +411,15 @@ Classifier: License :: OSI Approved :: MIT License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Programming Language :: Python :: Implementation :: CPython Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 +Classifier: Programming Language :: Python :: 3.9 +Classifier: Programming Language :: Python :: 3.10 Classifier: Topic :: Software Development :: Testing +Classifier: Framework :: Pytest +Requires-Python: >=3.6 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/pytest_timeout.egg-info/SOURCES.txt new/pytest-timeout-2.0.2/pytest_timeout.egg-info/SOURCES.txt --- old/pytest-timeout-1.4.2/pytest_timeout.egg-info/SOURCES.txt 2020-07-15 21:25:23.000000000 +0200 +++ new/pytest-timeout-2.0.2/pytest_timeout.egg-info/SOURCES.txt 2021-12-13 20:32:59.000000000 +0100 @@ -3,7 +3,6 @@ README.rst failure_demo.py pytest_timeout.py -setup.cfg setup.py test_pytest_timeout.py tox.ini diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/pytest_timeout.egg-info/requires.txt new/pytest-timeout-2.0.2/pytest_timeout.egg-info/requires.txt --- old/pytest-timeout-1.4.2/pytest_timeout.egg-info/requires.txt 2020-07-15 21:25:23.000000000 +0200 +++ new/pytest-timeout-2.0.2/pytest_timeout.egg-info/requires.txt 2021-12-13 20:32:59.000000000 +0100 @@ -1 +1 @@ -pytest>=3.6.0 +pytest>=5.0.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/pytest_timeout.py new/pytest-timeout-2.0.2/pytest_timeout.py --- old/pytest-timeout-1.4.2/pytest_timeout.py 2020-07-15 21:20:47.000000000 +0200 +++ new/pytest-timeout-2.0.2/pytest_timeout.py 2021-11-02 21:30:06.000000000 +0100 @@ -13,7 +13,6 @@ import threading import traceback from collections import namedtuple -from distutils.version import LooseVersion import py import pytest @@ -29,9 +28,9 @@ means no timeout. """.strip() METHOD_DESC = """ -Timeout mechanism to use. 'signal' uses SIGALRM if available, -'thread' uses a timer thread. The default is to use 'signal' and fall -back to 'thread'. +Timeout mechanism to use. 'signal' uses SIGALRM, 'thread' uses a timer +thread. If unspecified 'signal' is used on platforms which support +SIGALRM, otherwise 'thread' is used. """.strip() FUNC_ONLY_DESC = """ When set to True, defers the timeout evaluation to only the test @@ -41,7 +40,7 @@ # bdb covers pdb, ipdb, and possibly others # pydevd covers PyCharm, VSCode, and possibly others -KNOWN_DEBUGGING_MODULES = {"pydevd", "bdb"} +KNOWN_DEBUGGING_MODULES = {"pydevd", "bdb", "pydevd_frame_evaluator"} Settings = namedtuple("Settings", ["timeout", "method", "func_only"]) @@ -180,7 +179,7 @@ if trace_func and inspect.getmodule(trace_func): parts = inspect.getmodule(trace_func).__name__.split(".") for name in KNOWN_DEBUGGING_MODULES: - if name in parts: + if any(part.startswith(name) for part in parts): return True return False @@ -193,7 +192,15 @@ params = get_params(item) if params.timeout is None or params.timeout <= 0: return - if params.method == "signal": + + timeout_method = params.method + if ( + timeout_method == "signal" + and threading.current_thread() is not threading.main_thread() + ): + timeout_method = "thread" + + if timeout_method == "signal": def handler(signum, frame): __tracebackhide__ = True @@ -206,7 +213,7 @@ item.cancel_timeout = cancel signal.signal(signal.SIGALRM, handler) signal.setitimer(signal.ITIMER_REAL, params.timeout) - elif params.method == "thread": + elif timeout_method == "thread": timer = threading.Timer(params.timeout, timeout_timer, (item, params.timeout)) timer.name = "%s %s" % (__name__, item.nodeid) @@ -386,12 +393,8 @@ try: capman = item.config.pluginmanager.getplugin("capturemanager") if capman: - pytest_version = LooseVersion(pytest.__version__) - if pytest_version >= LooseVersion("3.7.3"): - capman.suspend_global_capture(item) - stdout, stderr = capman.read_global_capture() - else: - stdout, stderr = capman.suspend_global_capture(item) + capman.suspend_global_capture(item) + stdout, stderr = capman.read_global_capture() else: stdout, stderr = None, None write_title("Timeout", sep="+") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/setup.cfg new/pytest-timeout-2.0.2/setup.cfg --- old/pytest-timeout-1.4.2/setup.cfg 2020-07-15 21:25:23.076116000 +0200 +++ new/pytest-timeout-2.0.2/setup.cfg 2021-12-13 20:32:59.685103200 +0100 @@ -1,6 +1,3 @@ -[bdist_wheel] -universal = 1 - [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/setup.py new/pytest-timeout-2.0.2/setup.py --- old/pytest-timeout-1.4.2/setup.py 2020-07-15 21:24:51.000000000 +0200 +++ new/pytest-timeout-2.0.2/setup.py 2021-12-13 20:28:29.000000000 +0100 @@ -1,24 +1,23 @@ """Setuptools install script for pytest-timeout.""" -import io - from setuptools import setup -with io.open("README.rst", encoding="utf-8") as f: +with open("README.rst", encoding="utf-8") as f: long_description = f.read() setup( name="pytest-timeout", - description="py.test plugin to abort hanging tests", + description="pytest plugin to abort hanging tests", long_description=long_description, - version="1.4.2", + version="2.0.2", author="Floris Bruynooghe", author_email="f...@devork.be", - url="http://github.com/pytest-dev/pytest-timeout/", + url="https://github.com/pytest-dev/pytest-timeout", license="MIT", py_modules=["pytest_timeout"], entry_points={"pytest11": ["timeout = pytest_timeout"]}, - install_requires=["pytest>=3.6.0"], + install_requires=["pytest>=5.0.0"], + python_requires=">=3.6", classifiers=[ "Development Status :: 5 - Production/Stable", "Environment :: Console", @@ -28,12 +27,16 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", - "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Topic :: Software Development :: Testing", + "Framework :: Pytest", ], ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/test_pytest_timeout.py new/pytest-timeout-2.0.2/test_pytest_timeout.py --- old/pytest-timeout-1.4.2/test_pytest_timeout.py 2020-07-15 21:20:47.000000000 +0200 +++ new/pytest-timeout-2.0.2/test_pytest_timeout.py 2021-11-02 21:30:06.000000000 +0100 @@ -31,9 +31,9 @@ def test_x(): pass """ ) - result = testdir.runpytest("--timeout=0.01") + result = testdir.runpytest("--timeout=1") result.stdout.fnmatch_lines( - ["timeout: 0.01s", "timeout method:*", "timeout func_only:*"] + ["timeout: 1.0s", "timeout method:*", "timeout func_only:*"] ) @@ -47,8 +47,8 @@ time.sleep(2) """ ) - result = testdir.runpytest("--timeout=0.01") - result.stdout.fnmatch_lines(["*Failed: Timeout >0.01s*"]) + result = testdir.runpytest("--timeout=1") + result.stdout.fnmatch_lines(["*Failed: Timeout >1.0s*"]) def test_thread(testdir): @@ -60,7 +60,7 @@ time.sleep(2) """ ) - result = testdir.runpytest("--timeout=0.01", "--timeout-method=thread") + result = testdir.runpytest("--timeout=1", "--timeout-method=thread") result.stderr.fnmatch_lines( [ "*++ Timeout ++*", @@ -77,6 +77,7 @@ ) def test_cov(testdir): # This test requires pytest-cov + pytest.importorskip("pytest_cov") testdir.makepyfile( """ import time @@ -86,7 +87,7 @@ """ ) result = testdir.runpytest( - "--timeout=0.01", "--cov=test_cov.py", "--timeout-method=thread" + "--timeout=1", "--cov=test_cov", "--timeout-method=thread" ) result.stderr.fnmatch_lines( [ @@ -108,7 +109,7 @@ time.sleep(2) """ ) - monkeypatch.setitem(os.environ, "PYTEST_TIMEOUT", "0.01") + monkeypatch.setitem(os.environ, "PYTEST_TIMEOUT", "1") result = testdir.runpytest() assert result.ret > 0 @@ -150,7 +151,7 @@ scope=scope ) ) - result = testdir.runpytest("--timeout=0.01", "--timeout-method={}".format(meth)) + result = testdir.runpytest("--timeout=1", f"--timeout-method={meth}") assert result.ret > 0 assert "Timeout" in result.stdout.str() + result.stderr.str() @@ -171,7 +172,7 @@ pass """ ) - result = testdir.runpytest("--timeout=0.01") + result = testdir.runpytest("--timeout=1") assert result.ret == 0 assert "Timeout" not in result.stdout.str() + result.stderr.str() @@ -197,9 +198,7 @@ pass """ ) - result = testdir.runpytest( - "--timeout=0.01", "-s", "--timeout-method={}".format(meth) - ) + result = testdir.runpytest("--timeout=1", "-s", f"--timeout-method={meth}") assert result.ret > 0 assert "Timeout" in result.stdout.str() + result.stderr.str() @@ -224,7 +223,7 @@ pass """ ) - result = testdir.runpytest("--timeout=0.01", "-s") + result = testdir.runpytest("--timeout=1", "-s") assert result.ret == 0 assert "Timeout" not in result.stdout.str() + result.stderr.str() @@ -235,14 +234,14 @@ """ import time, pytest - @pytest.mark.timeout(0.01) + @pytest.mark.timeout(1) def test_foo(): time.sleep(2) assert False """ ) result = testdir.runpytest() - result.stdout.fnmatch_lines(["*Failed: Timeout >0.01s*"]) + result.stdout.fnmatch_lines(["*Failed: Timeout >1.0s*"]) def test_timeout_mark_timer(testdir): @@ -250,7 +249,7 @@ """ import time, pytest - @pytest.mark.timeout(0.01) + @pytest.mark.timeout(1) def test_foo(): time.sleep(2) """ @@ -306,7 +305,7 @@ """ import time, pytest - @pytest.mark.timeout(0.01, 'thread') + @pytest.mark.timeout(1, 'thread') def test_foo(): time.sleep(2) """ @@ -341,7 +340,7 @@ testdir.makeini( """ [pytest] - timeout = 0.01 + timeout = 1 """ ) result = testdir.runpytest() @@ -355,7 +354,7 @@ @pytest.fixture def slow(): - time.sleep(0.1) + time.sleep(2) def test_foo(slow): pass @@ -364,7 +363,7 @@ testdir.makeini( """ [pytest] - timeout = 0.01 + timeout = 1 timeout_func_only = true """ ) @@ -384,7 +383,7 @@ testdir.makeini( """ [pytest] - timeout = 0.01 + timeout = 1 timeout_method = thread """ ) @@ -397,18 +396,18 @@ """ import time, pytest - @pytest.mark.timeout(timeout=0.05) + @pytest.mark.timeout(timeout=2) class TestFoo: - @pytest.mark.timeout(timeout=0.5) + @pytest.mark.timeout(timeout=3) def test_foo_2(self): - time.sleep(0.1) + time.sleep(2) def test_foo_1(self): - time.sleep(0.01) + time.sleep(1) """ ) - result = testdir.runpytest("--timeout=0.01", "-s") + result = testdir.runpytest("--timeout=1", "-s") assert result.ret == 0 assert "Timeout" not in result.stdout.str() + result.stderr.str() @@ -445,7 +444,7 @@ """ import pytest, {debugging_module} - @pytest.mark.timeout(0.1) + @pytest.mark.timeout(1) def test_foo(): {debugging_module}.{debugging_set_trace} """.format( @@ -460,7 +459,7 @@ result = child.read().decode().lower() if child.isalive(): child.terminate(force=True) - assert "timeout >0.01s" not in result + assert "timeout >1.0s" not in result assert "fail" not in result @@ -483,3 +482,27 @@ module.custom_trace = custom_trace assert pytest_timeout.is_debugging(custom_trace) + + +def test_not_main_thread(testdir): + testdir.makepyfile( + """ + import threading + import pytest_timeout + + current_timeout_setup = pytest_timeout.timeout_setup + + def new_timeout_setup(item): + threading.Thread( + target=current_timeout_setup, args=(item), + ).join() + + pytest_timeout.timeout_setup = new_timeout_setup + + def test_x(): pass + """ + ) + result = testdir.runpytest("--timeout=1") + result.stdout.fnmatch_lines( + ["timeout: 1.0s", "timeout method:*", "timeout func_only:*"] + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-timeout-1.4.2/tox.ini new/pytest-timeout-2.0.2/tox.ini --- old/pytest-timeout-1.4.2/tox.ini 2020-06-15 20:55:30.000000000 +0200 +++ new/pytest-timeout-2.0.2/tox.ini 2021-10-10 20:49:34.000000000 +0200 @@ -3,13 +3,14 @@ addopts = -ra [tox] -envlist = py27,py35,py36,py37,py38,pypy2,pypy3 +envlist = py36,py37,py38,py39,py310,pypy3 [testenv] deps = pytest pexpect ipdb pytest-cov + pytest-github-actions-annotate-failures commands = pytest {posargs} [testenv:linting]