Giter Club home page Giter Club logo

Comments (6)

pytest-timeout-bot avatar pytest-timeout-bot commented on July 23, 2024

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.

pytest-timeout-bot avatar pytest-timeout-bot commented on July 23, 2024

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.

pytest-timeout-bot avatar pytest-timeout-bot commented on July 23, 2024

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.

pytest-timeout-bot avatar pytest-timeout-bot commented on July 23, 2024

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.

pytest-timeout-bot avatar pytest-timeout-bot commented on July 23, 2024

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.

pytest-timeout-bot avatar pytest-timeout-bot commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.