Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test failures with Python 3.12 due to warnings (from pytest) #85

Open
mgorny opened this issue May 24, 2023 · 3 comments
Open

Test failures with Python 3.12 due to warnings (from pytest) #85

mgorny opened this issue May 24, 2023 · 3 comments

Comments

@mgorny
Copy link
Contributor

mgorny commented May 24, 2023

While technically the "problem" is in pytest itself, I think it'd be better if the test suite would be more resilient to warnings that don't affect the result.

========================================================= test session starts =========================================================
platform linux -- Python 3.12.0b1, pytest-7.3.1, pluggy-1.0.0
cachedir: .tox/py312/.pytest_cache
rootdir: /tmp/pytest-forked
configfile: tox.ini
plugins: forked-1.6.1.dev4+gd9d05e2
collected 10 items                                                                                                                    

testing/test_boxed.py ...xx.                                                                                                    [ 60%]
testing/test_xfail_behavior.py .F.F                                                                                             [100%]

============================================================== FAILURES ===============================================================
______________________________________________________ test_xfail[strict xpass] _______________________________________________________

is_crashing = False, is_strict = True, testdir = <Testdir local('/tmp/pytest-of-mgorny/pytest-2/test_xfail1')>

    @pytest.mark.parametrize(
        ("is_crashing", "is_strict"),
        (
            pytest.param(True, True, id="strict xfail"),
            pytest.param(False, True, id="strict xpass"),
            pytest.param(True, False, id="non-strict xfail"),
            pytest.param(False, False, id="non-strict xpass"),
        ),
    )
    def test_xfail(is_crashing, is_strict, testdir):
        """Test xfail/xpass/strict permutations."""
        # pylint: disable=possibly-unused-variable
        sig_num = signal.SIGTERM.numerator
    
        test_func_body = (
            "os.kill(os.getpid(), signal.SIGTERM)" if is_crashing else "assert True"
        )
    
        if is_crashing:
            # marked xfailed and crashing, no matter strict or not
            expected_letter = "x"  # XFAILED
            expected_lowercase = "xfailed"
            expected_word = "XFAIL"
        elif is_strict:
            # strict and not failing as expected should cause failure
            expected_letter = "F"  # FAILED
            expected_lowercase = "failed"
            expected_word = FAILED_WORD
        elif not is_strict:
            # non-strict and not failing as expected should cause xpass
            expected_letter = "X"  # XPASS
            expected_lowercase = "xpassed"
            expected_word = "XPASS"
    
        session_start_title = "*==== test session starts ====*"
        loaded_pytest_plugins = "plugins: forked*"
        collected_tests_num = "collected 1 item"
        expected_progress = f"test_xfail.py {expected_letter!s}*"
        failures_title = "*==== FAILURES ====*"
        failures_test_name = "*____ test_function ____*"
        failures_test_reason = "[XPASS(strict)] The process gets terminated"
        short_test_summary_title = "*==== short test summary info ====*"
        short_test_summary = f"{expected_word!s} test_xfail.py::test_function"
        if expected_lowercase == "xpassed":
            # XPASS wouldn't have the crash message from
            # pytest-forked because the crash doesn't happen
            short_test_summary = " ".join(
                (
                    short_test_summary,
                    "The process gets terminated",
                )
            )
        reason_string = (
            f"reason: The process gets terminated; "
            f"pytest-forked reason: "
            f"*:*: running the test CRASHED with signal {sig_num:d}"
        )
        if expected_lowercase == "xfailed" and PYTEST_GTE_7_2:
            short_test_summary += " - " + reason_string
        total_summary_line = f"*==== 1 {expected_lowercase!s} in 0.*s* ====*"
    
        expected_lines = (
            session_start_title,
            loaded_pytest_plugins,
            collected_tests_num,
            expected_progress,
        )
        if expected_word == FAILED_WORD:
            # XPASS(strict)
            expected_lines += (
                failures_title,
                failures_test_name,
                failures_test_reason,
            )
        expected_lines += (
            short_test_summary_title,
            short_test_summary,
        )
        if expected_lowercase == "xpassed" and expected_word == FAILED_WORD:
            # XPASS(strict)
            expected_lines += ("  " + reason_string,)
        expected_lines += (total_summary_line,)
    
        test_module = testdir.makepyfile(
            f"""
            import os
            import signal
    
            import pytest
    
            # The current implementation emits RuntimeWarning.
            pytestmark = pytest.mark.filterwarnings('ignore:pytest-forked xfail')
    
            @pytest.mark.xfail(
                reason='The process gets terminated',
                strict={is_strict!s},
            )
            @pytest.mark.forked
            def test_function():
                {test_func_body!s}
            """
        )
    
        pytest_run_result = testdir.runpytest(test_module, "-ra")
>       pytest_run_result.stdout.fnmatch_lines(expected_lines)
E       Failed: fnmatch: '*==== test session starts ====*'
E          with: '========================================================= test session starts ========================================================='
E       nomatch: 'plugins: forked*'
E           and: 'platform linux -- Python 3.12.0b1, pytest-7.3.1, pluggy-1.0.0'
E           and: 'rootdir: /tmp/pytest-of-mgorny/pytest-2/test_xfail1'
E       fnmatch: 'plugins: forked*'
E          with: 'plugins: forked-1.6.1.dev4+gd9d05e2'
E       exact match: 'collected 1 item'
E       nomatch: 'test_xfail.py F*'
E           and: ''
E       fnmatch: 'test_xfail.py F*'
E          with: 'test_xfail.py F                                                                                                                 [100%]'
E       nomatch: '*==== FAILURES ====*'
E           and: ''
E       fnmatch: '*==== FAILURES ====*'
E          with: '============================================================== FAILURES ==============================================================='
E       fnmatch: '*____ test_function ____*'
E          with: '____________________________________________________________ test_function ____________________________________________________________'
E       exact match: '[XPASS(strict)] The process gets terminated'
E       nomatch: '*==== short test summary info ====*'
E           and: '========================================================== warnings summary ==========================================================='
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    assertmsg = ast.Str("")'
E           and: ''
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation))'
E           and: ''
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    keys = [ast.Str(key) for key in current.keys()]'
E           and: ''
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    clear = ast.Assign(variables, ast.NameConstant(None))'
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E       fnmatch: '*==== short test summary info ====*'
E          with: '======================================================= short test summary info ======================================================='
E       exact match: 'FAILED test_xfail.py::test_function'
E       nomatch: '*==== 1 failed in 0.*s* ====*'
E           and: '==================================================== 1 failed, 4 warnings in 0.01s ===================================================='
E       remains unmatched: '*==== 1 failed in 0.*s* ====*'

/tmp/pytest-forked/testing/test_xfail_behavior.py:121: Failed
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
========================================================= test session starts =========================================================
platform linux -- Python 3.12.0b1, pytest-7.3.1, pluggy-1.0.0
rootdir: /tmp/pytest-of-mgorny/pytest-2/test_xfail1
plugins: forked-1.6.1.dev4+gd9d05e2
collected 1 item

test_xfail.py F                                                                                                                 [100%]

============================================================== FAILURES ===============================================================
____________________________________________________________ test_function ____________________________________________________________
[XPASS(strict)] The process gets terminated
========================================================== warnings summary ===========================================================
../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    assertmsg = ast.Str("")

../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation))

../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    keys = [ast.Str(key) for key in current.keys()]

../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
    clear = ast.Assign(variables, ast.NameConstant(None))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= short test summary info =======================================================
FAILED test_xfail.py::test_function
==================================================== 1 failed, 4 warnings in 0.01s ====================================================
____________________________________________________ test_xfail[non-strict xpass] _____________________________________________________

is_crashing = False, is_strict = False, testdir = <Testdir local('/tmp/pytest-of-mgorny/pytest-2/test_xfail3')>

    @pytest.mark.parametrize(
        ("is_crashing", "is_strict"),
        (
            pytest.param(True, True, id="strict xfail"),
            pytest.param(False, True, id="strict xpass"),
            pytest.param(True, False, id="non-strict xfail"),
            pytest.param(False, False, id="non-strict xpass"),
        ),
    )
    def test_xfail(is_crashing, is_strict, testdir):
        """Test xfail/xpass/strict permutations."""
        # pylint: disable=possibly-unused-variable
        sig_num = signal.SIGTERM.numerator
    
        test_func_body = (
            "os.kill(os.getpid(), signal.SIGTERM)" if is_crashing else "assert True"
        )
    
        if is_crashing:
            # marked xfailed and crashing, no matter strict or not
            expected_letter = "x"  # XFAILED
            expected_lowercase = "xfailed"
            expected_word = "XFAIL"
        elif is_strict:
            # strict and not failing as expected should cause failure
            expected_letter = "F"  # FAILED
            expected_lowercase = "failed"
            expected_word = FAILED_WORD
        elif not is_strict:
            # non-strict and not failing as expected should cause xpass
            expected_letter = "X"  # XPASS
            expected_lowercase = "xpassed"
            expected_word = "XPASS"
    
        session_start_title = "*==== test session starts ====*"
        loaded_pytest_plugins = "plugins: forked*"
        collected_tests_num = "collected 1 item"
        expected_progress = f"test_xfail.py {expected_letter!s}*"
        failures_title = "*==== FAILURES ====*"
        failures_test_name = "*____ test_function ____*"
        failures_test_reason = "[XPASS(strict)] The process gets terminated"
        short_test_summary_title = "*==== short test summary info ====*"
        short_test_summary = f"{expected_word!s} test_xfail.py::test_function"
        if expected_lowercase == "xpassed":
            # XPASS wouldn't have the crash message from
            # pytest-forked because the crash doesn't happen
            short_test_summary = " ".join(
                (
                    short_test_summary,
                    "The process gets terminated",
                )
            )
        reason_string = (
            f"reason: The process gets terminated; "
            f"pytest-forked reason: "
            f"*:*: running the test CRASHED with signal {sig_num:d}"
        )
        if expected_lowercase == "xfailed" and PYTEST_GTE_7_2:
            short_test_summary += " - " + reason_string
        total_summary_line = f"*==== 1 {expected_lowercase!s} in 0.*s* ====*"
    
        expected_lines = (
            session_start_title,
            loaded_pytest_plugins,
            collected_tests_num,
            expected_progress,
        )
        if expected_word == FAILED_WORD:
            # XPASS(strict)
            expected_lines += (
                failures_title,
                failures_test_name,
                failures_test_reason,
            )
        expected_lines += (
            short_test_summary_title,
            short_test_summary,
        )
        if expected_lowercase == "xpassed" and expected_word == FAILED_WORD:
            # XPASS(strict)
            expected_lines += ("  " + reason_string,)
        expected_lines += (total_summary_line,)
    
        test_module = testdir.makepyfile(
            f"""
            import os
            import signal
    
            import pytest
    
            # The current implementation emits RuntimeWarning.
            pytestmark = pytest.mark.filterwarnings('ignore:pytest-forked xfail')
    
            @pytest.mark.xfail(
                reason='The process gets terminated',
                strict={is_strict!s},
            )
            @pytest.mark.forked
            def test_function():
                {test_func_body!s}
            """
        )
    
        pytest_run_result = testdir.runpytest(test_module, "-ra")
>       pytest_run_result.stdout.fnmatch_lines(expected_lines)
E       Failed: fnmatch: '*==== test session starts ====*'
E          with: '========================================================= test session starts ========================================================='
E       nomatch: 'plugins: forked*'
E           and: 'platform linux -- Python 3.12.0b1, pytest-7.3.1, pluggy-1.0.0'
E           and: 'rootdir: /tmp/pytest-of-mgorny/pytest-2/test_xfail3'
E       fnmatch: 'plugins: forked*'
E          with: 'plugins: forked-1.6.1.dev4+gd9d05e2'
E       exact match: 'collected 1 item'
E       nomatch: 'test_xfail.py X*'
E           and: ''
E       fnmatch: 'test_xfail.py X*'
E          with: 'test_xfail.py X                                                                                                                 [100%]'
E       nomatch: '*==== short test summary info ====*'
E           and: ''
E           and: '========================================================== warnings summary ==========================================================='
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    assertmsg = ast.Str("")'
E           and: ''
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation))'
E           and: ''
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    keys = [ast.Str(key) for key in current.keys()]'
E           and: ''
E           and: '../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941'
E           and: '  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead'
E           and: '    clear = ast.Assign(variables, ast.NameConstant(None))'
E           and: ''
E           and: '-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html'
E       fnmatch: '*==== short test summary info ====*'
E          with: '======================================================= short test summary info ======================================================='
E       exact match: 'XPASS test_xfail.py::test_function The process gets terminated'
E       nomatch: '*==== 1 xpassed in 0.*s* ====*'
E           and: '=================================================== 1 xpassed, 4 warnings in 0.01s ===================================================='
E       remains unmatched: '*==== 1 xpassed in 0.*s* ====*'

/tmp/pytest-forked/testing/test_xfail_behavior.py:121: Failed
-------------------------------------------------------- Captured stdout call ---------------------------------------------------------
========================================================= test session starts =========================================================
platform linux -- Python 3.12.0b1, pytest-7.3.1, pluggy-1.0.0
rootdir: /tmp/pytest-of-mgorny/pytest-2/test_xfail3
plugins: forked-1.6.1.dev4+gd9d05e2
collected 1 item

test_xfail.py X                                                                                                                 [100%]

========================================================== warnings summary ===========================================================
../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    assertmsg = ast.Str("")

../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation))

../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    keys = [ast.Str(key) for key in current.keys()]

../../../pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
    clear = ast.Assign(variables, ast.NameConstant(None))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= short test summary info =======================================================
XPASS test_xfail.py::test_function The process gets terminated
=================================================== 1 xpassed, 4 warnings in 0.01s ====================================================
========================================================== warnings summary ===========================================================
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:683
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:683
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:683
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:683: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    and isinstance(item.value, ast.Str)

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:685
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:685
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:685: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
    doc = item.value.s

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:965
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:965
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:965
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:965
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:965
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:965: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    inlocs = ast.Compare(ast.Str(name.id), [ast.In()], [locs])

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:968
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:968
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:968
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:968
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:968
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:968: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    expr = ast.IfExp(test, self.display(name), ast.Str(name.id))

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1102
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1102
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1102: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    syms.append(ast.Str(sym))

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1104
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1104
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:1104: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    expls.append(ast.Str(expl))

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:817: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    keys = [ast.Str(key) for key in current.keys()]

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:927: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    assertmsg = ast.Str("")

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:929: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    template = ast.BinOp(assertmsg, ast.Add(), ast.Str(explanation))

.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941
.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941
  /tmp/pytest-forked/.tox/py312/lib/python3.12/site-packages/_pytest/assertion/rewrite.py:941: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
    clear = ast.Assign(variables, ast.NameConstant(None))

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================= short test summary info =======================================================
FAILED testing/test_xfail_behavior.py::test_xfail[strict xpass] - Failed: fnmatch: '*==== test session starts ====*'
FAILED testing/test_xfail_behavior.py::test_xfail[non-strict xpass] - Failed: fnmatch: '*==== test session starts ====*'
XFAIL testing/test_boxed.py::test_functional_boxed_capturing[sys] - capture cleanup needed
XFAIL testing/test_boxed.py::test_functional_boxed_capturing[fd] - capture cleanup needed
========================================= 2 failed, 6 passed, 2 xfailed, 37 warnings in 0.66s =========================================
@mgorny
Copy link
Contributor Author

mgorny commented May 24, 2023

Hmm, it seems that after patching pytest, it's now failing due to a problem in py:

E           and: 'test_xfail.py::test_function'
E           and: '  /usr/lib/python3.12/site-packages/py/_process/forkedfunc.py:45: DeprecationWarning: This process (pid=66) is multi-threaded, use of fork() may lead to deadlocks in the child.'
E           and: '    pid = os.fork()'

@nicoddemus
Copy link
Member

The warnings will be fixed by pytest-dev/pytest#10894.

@mgorny
Copy link
Contributor Author

mgorny commented May 24, 2023

The warnings will be fixed by pytest-dev/pytest#10894.

This doesn't fix the warning from py.process.ForkedFunc().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants