Comments (6)
Original comment by Alexander Petrov (Bitbucket: alvipet, ).
I use:
python (2.7.13)
pytest-timeout (1.2.1)
pytest (3.3.1)
I run it all under virtualenv (15.1.0)
Thanks
from pytest-timeout.
Original comment by Floris Bruynooghe (Bitbucket: flub, GitHub: flub).
Hi,
Could you provide some more information please? What was the example you where running? What where you expecting to happen? From this traceback all I can see is that a timeout happended inside the time.sleep() call in your test, so I'm not sure what the problem is.
It's entirely possible I've missed something obvious and crucial though, hence please provide some more info.
Thanks
from pytest-timeout.
Original comment by Alexander Petrov (Bitbucket: alvipet, ).
Hi, Floris
Forgot to say that the test was running on Windows 10. I tried the simple test in the same configuration.
#!python
import pytest
@pytest.mark.timeout(2)
def test_01():
for i in xrange(100000000):
x = 2 * 2
@pytest.mark.timeout(2)
def test_02():
for i in xrange(100):
x = 2 * 2
Here is the output:
#!python
+++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++
~~~~~~~~~~~~~~~~~~~~~~~~~ Stack of MainThread (10232) ~~~~~~~~~~~~~~~~~~~~~~~~~~
File "d:\python\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "d:\python\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "D:\Python\Python27\Scripts\pytest.exe\__main__.py", line 9, in <module>
sys.exit(main())
File "d:\python\python27\lib\site-packages\_pytest\config.py", line 59, in main
return config.hook.pytest_cmdline_main(config=config)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "d:\python\python27\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "d:\python\python27\lib\site-packages\_pytest\main.py", line 136, in pytest_cmdline_main
return wrap_session(config, _main)
File "d:\python\python27\lib\site-packages\_pytest\main.py", line 105, in wrap_session
session.exitstatus = doit(config, session) or 0
File "d:\python\python27\lib\site-packages\_pytest\main.py", line 143, in _main
config.hook.pytest_runtestloop(session=session)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "d:\python\python27\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "d:\python\python27\lib\site-packages\_pytest\main.py", line 166, in pytest_runtestloop
item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "d:\python\python27\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "d:\python\python27\lib\site-packages\_pytest\runner.py", line 62, in pytest_runtest_protocol
runtestprotocol(item, nextitem=nextitem)
File "d:\python\python27\lib\site-packages\_pytest\runner.py", line 76, in runtestprotocol
reports.append(call_and_report(item, "call", log))
File "d:\python\python27\lib\site-packages\_pytest\runner.py", line 155, in call_and_report
call = call_runtest_hook(item, when, **kwds)
File "d:\python\python27\lib\site-packages\_pytest\runner.py", line 175, in call_runtest_hook
return CallInfo(lambda: ihook(item=item, **kwds), when=when)
File "d:\python\python27\lib\site-packages\_pytest\runner.py", line 189, in __init__
self.result = func()
File "d:\python\python27\lib\site-packages\_pytest\runner.py", line 175, in <lambda>
return CallInfo(lambda: ihook(item=item, **kwds), when=when)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "d:\python\python27\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "d:\python\python27\lib\site-packages\_pytest\runner.py", line 106, in pytest_runtest_call
item.runtest()
File "d:\python\python27\lib\site-packages\_pytest\python.py", line 1171, in runtest
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 617, in __call__
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 222, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "d:\python\python27\lib\site-packages\pluggy\__init__.py", line 216, in <lambda>
firstresult=hook.spec_opts.get('firstresult'),
File "d:\python\python27\lib\site-packages\pluggy\callers.py", line 180, in _multicall
res = hook_impl.function(*args)
File "d:\python\python27\lib\site-packages\_pytest\python.py", line 147, in pytest_pyfunc_call
testfunction(**testargs)
File "D:\data\dev\jopin\TMP\test_01.py", line 6, in test_01
x = 2 * 2
+++++++++++++++++++++++++++++++++++ Timeout ++++++++++++++++++++++++++++++++++++
from pytest-timeout.
Original comment by Floris Bruynooghe (Bitbucket: flub, GitHub: flub).
Hi,
The first test is timing out and then execution is terminated. It looks to me as it's doing exactly what pytest-timeout is designed to do.
You still didn't say what you expected to happen in your test case and why? I'm honestly not seeing the issue here.
from pytest-timeout.
Original comment by Alexander Petrov (Bitbucket: alvipet, ).
Hi,
You are right. The first test is terminated, but I can't get xunit file as test results after this command:
#!python
pytest -v --junit-xml=log.xml
from pytest-timeout.
Original comment by Floris Bruynooghe (Bitbucket: flub, GitHub: flub).
Sure, that's correct. See https://bitbucket.org/pytest-dev/pytest-timeout/src/03c23b4e46254f87cb3bb642bf3d450a5c59e731/README?at=default&fileviewer=file-view-default#README-100 where this is described.
from pytest-timeout.
Related Issues (20)
- Status of support for timeouts in native code HOT 2
- `timeout_func_only = true` config does not work HOT 7
- Flask pytest client.post request - timeout error
- is_debugging does not work in VS Code HOT 1
- New Version HOT 9
- how can I get rid of the stack-trace HOT 4
- Question/feature request: way to pause timing HOT 5
- Pytest times out in debug mode with Pycharm 2023.2.1 HOT 1
- pytest timeout in pytest.ini is not working HOT 4
- Measure CPU time instead of wallclock time HOT 4
- Bad and misleading test HOT 2
- subprocess not killed when timeout fires HOT 4
- INTERNALERROR with pytest_configure HOT 2
- feature request: add suite timeout HOT 6
- default branch: master -> main HOT 2
- [QUESTION] When can we expect a release? HOT 3
- [question] hook for executing small bit of code before timeout fires HOT 1
- RFE: is it possible to start making github releases?🤔 HOT 1
- Are timeouts supposed to result in Error or Failure or both? HOT 5
- Suggestion: Using capturemanager.global_and_fixture_disabled HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytest-timeout.