pytest-dev / pytest-dev/pytest-timeout

Bad and misleading test

Open
#158 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
258
Forks
69
PR merge metrics
No merged PRs in 30d

Description

I believe there's a test that is not testing anything anymore.
The test was introduced in https://github.com/pytest-dev/pytest-timeout/pull/88, https://github.com/pytest-dev/pytest-timeout/commit/1a35f94298c1260500907bd674b75cf59df0c949

================================================================================================ test session starts ================================================================================================
platform linux -- Python 3.10.2, pytest-7.4.3, pluggy-1.3.0
rootdir: /tmp/pytest-of-vampas/pytest-4/test_not_main_thread0
plugins: github-actions-annotate-failures-0.2.0, timeout-2.2.0, cov-4.1.0
timeout: 1.0s
timeout method: signal
timeout func_only: False
collected 0 items / 1 error
====================================================================================================== ERRORS =======================================================================================================
_____________________________________________________________________________________ ERROR collecting test_not_main_thread.py ______________________________________________________________________________________
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/python.py:531: in collect
    self._inject_setup_module_fixture()
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/python.py:545: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/python.py:310: in obj
    self._obj = obj = self._getobj()
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/python.py:528: in _getobj
    return self._importtestmodule()
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/python.py:617: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/pathlib.py:567: in import_path
    importlib.import_module(module_name)
/home/vampas/.pyenv/versions/3.10.2/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1050: in _gcd_import
    ???
<frozen importlib._bootstrap>:1027: in _find_and_load
    ???
<frozen importlib._bootstrap>:1006: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:688: in _load_unlocked
    ???
/home/vampas/projects/SaltStack/pytest/timeout/hotfix/settings-hook/.tox/py310/lib/python3.10/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
    exec(co, module.__dict__)
test_not_main_thread.py:4: in <module>
    current_timeout_setup = pytest_timeout.timeout_setup
E   AttributeError: module 'pytest_timeout' has no attribute 'timeout_setup'
============================================================================================== short test summary info ==============================================================================================
ERROR test_not_main_thread.py - AttributeError: module 'pytest_timeout' has no attribute 'timeout_setup'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================================================================= 1 error in 0.20s ==================================================================================================

Is this really what is getting tested? The error?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with test_not_main_thread.py and review the pull request and commit that introduced it. Run the test to confirm whether collection fails before any assertion, then determine the intended timeout behavior and make the test exercise that behavior. Done means the test no longer passes or fails solely because pytest_timeout.timeout_setup is missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.