Skip to content

Flaky test behavior introduced for py38 #98

@northernSage

Description

@northernSage

As title says, we are now getting tests fails related to proper process termination/cleanup ofr python 3.8. Traceback bellow:

________________________ test_interruption_cleanup __________________________

cls = <class '_pytest.runner.CallInfo'>
func = <function call_runtest_hook.<locals>.<lambda> at 0x000002B0B6A17B80>
when = 'call'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: "Callable[[], TResult]",
        when: "Literal['collect', 'setup', 'call', 'teardown']",
        reraise: Optional[
            Union[Type[BaseException], Tuple[Type[BaseException], ...]]
        ] = None,
    ) -> "CallInfo[TResult]":
        """Call func, wrapping the result in a CallInfo.
    
        :param func:
            The function to call. Called without arguments.
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        start = timing.time()
        precise_start = timing.perf_counter()
        try:
>           result: Optional[TResult] = func()

D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\lib\site-packages\_pytest\runner.py:338: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\lib\site-packages\_pytest\runner.py:259: in <lambda>
    lambda: ihook(item=item, **kwds), when=when, reraise=reraise
D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\lib\site-packages\pluggy\_hooks.py:265: in __call__
    return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\lib\site-packages\pluggy\_manager.py:80: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\lib\site-packages\_pytest\unraisableexception.py:88: in pytest_runtest_call
    yield from unraisable_exception_runtest_hook()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

    def unraisable_exception_runtest_hook() -> Generator[None, None, None]:
        with catch_unraisable_exception() as cm:
            yield
            if cm.unraisable:
                if cm.unraisable.err_msg is not None:
                    err_msg = cm.unraisable.err_msg
                else:
                    err_msg = "Exception ignored in"
                msg = f"{err_msg}: {cm.unraisable.object!r}\n\n"
                msg += "".join(
                    traceback.format_exception(
                        cm.unraisable.exc_type,
                        cm.unraisable.exc_value,
                        cm.unraisable.exc_traceback,
                    )
                )
>               warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E               pytest.PytestUnraisableExceptionWarning: Exception ignored in: <function Popen.__del__ at 0x000002B0B66CE280>
E               
E               Traceback (most recent call last):
E                 File "C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\subprocess.py", line 946, in __del__
E                   _warn("subprocess %s is still running" % self.pid,
E               ResourceWarning: subprocess 5[68](https://github.com/pytest-dev/pytest-xprocess/runs/6564442440?check_suite_focus=true#step:5:69)8 is still running

D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\lib\site-packages\_pytest\unraisableexception.py:78: PytestUnraisableExceptionWarning
---------------------------- Captured stdout call -----------------------------
running: D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\Scripts\python.EXE -mpytest --basetemp=C:\Users\runneradmin\AppData\Local\Temp\pytest-of-unknown\pytest-0\test_interruption_cleanup0\runpytest-0
     in: C:\Users\runneradmin\AppData\Local\Temp\pytest-of-unknown\pytest-0\test_interruption_cleanup0
============================= test session starts =============================
platform win32 -- Python 3.8.10, pytest-7.1.2, pluggy-1.0.0
rootdir: C:\Users\runneradmin\AppData\Local\Temp\pytest-of-unknown\pytest-0\test_interruption_cleanup0
plugins: xprocess-0.1.dev1+g3c65e4b
collected 1 item

test_interruption_cleanup.py 

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! KeyboardInterrupt !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
C:\Users\runneradmin\AppData\Local\Temp\pytest-of-unknown\pytest-0\test_interruption_cleanup0\test_interruption_cleanup.py:16: KeyboardInterrupt
(to show a full traceback on KeyboardInterrupt use --full-trace)
============================ no tests ran in 0.49s ============================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
10[76](https://github.com/pytest-dev/pytest-xprocess/runs/6564442440?check_suite_focus=true#step:5:77) server_test_interrupt DEAD C:\Users\runneradmin\AppData\Local\Temp\pytest-of-unknown\pytest-0\test_interruption_cleanup0\.pytest_cache\d\.xprocess\server_test_interrupt\xprocess.log
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
=========================== short test summary info ===========================
FAILED test_interruption_clean_up.py::test_interruption_cleanup - pytest.Pyte...
================== 1 failed, 41 passed, 3 skipped in 32.46s ===================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.
ERROR: InvocationError for command 'D:\a\pytest-xprocess\pytest-xprocess\.tox\py38\Scripts\coverage.EXE' run -m pytest -v (exited with code 1)
___________________________________ summary ___________________________________
ERROR:   py38: commands failed

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions