Skip to content

Pytest-assume generates warning in pluggy at teardown #59

@GeorgeFischhof

Description

@GeorgeFischhof

Hi,

Pytest-assume generates warning in pluggy at teardown:

used:
win 10
python 3.11.8
pytest 8.0.1
pytest-assume 2.4.3

The script just to check working of my environment (tried both the syntaxes using with, and not using with )

import pytest


# def test_my_env():
#     with pytest.assume:
#         assert False
#     with pytest.assume:
#         assert True
#     with pytest.assume:
#         assert False

def test_my_env():
    pytest.assume(False)
    pytest.assume(True)
    pytest.assume(False)

the output

================================================= test session starts =================================================
platform win32 -- Python 3.11.8, pytest-8.0.1, pluggy-1.4.0
rootdir: c:\George\Work\tests
configfile: pyproject.toml
plugins: assume-2.4.3, html-4.1.1, metadata-3.1.1
collected 1 item

test_my_env.py::test_my_env FAILED                                                                               [100%]

====================================================== FAILURES =======================================================
_____________________________________________________ test_my_env _____________________________________________________

tp = <class 'pytest_assume.plugin.FailedAssumption'>, value = None, tb = None

    def reraise(tp, value, tb=None):
        try:
            if value is None:
                value = tp()
            if value.__traceback__ is not tb:
>               raise value.with_traceback(tb)
E               pytest_assume.plugin.FailedAssumption:
E               2 Failed Assumptions:
E
E               test_my_env.py:14: AssumptionFailure
E               >>      pytest.assume(False)
E               AssertionError: assert False
E
E               test_my_env.py:16: AssumptionFailure
E               >>      pytest.assume(False)
E               AssertionError: assert False

.venv\Lib\site-packages\six.py:718: FailedAssumption
================================================== warnings summary ===================================================
test_my_env.py::test_my_env
  c:\George\Work\tests\.venv\Lib\site-packages\_pytest\runner.py:267: PluggyTeardownRaisedWarning: A plugin raised an exception during an old-style hookwrapper teardown.
  Plugin: assume, Hook: pytest_runtest_call
  FailedAssumption:
  2 Failed Assumptions:

  test_my_env.py:14: AssumptionFailure
  >>    pytest.assume(False)
  AssertionError: assert False

  test_my_env.py:16: AssumptionFailure
  >>    pytest.assume(False)
  AssertionError: assert False


  For more information see https://pluggy.readthedocs.io/en/stable/api_reference.html#pluggy.PluggyTeardownRaisedWarning
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
------------------------ Generated html report: file:///c:/George/Work/tests/test_result.html -------------------------
=============================================== short test summary info ===============================================
FAILED test_my_env.py::test_my_env - pytest_assume.plugin.FailedAssumption:
============================================ 1 failed, 1 warning in 0.05s =============================================

this seems a bit relating to #58

BR,
George

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions