Closed hroncok closed 4 years ago
Looks like this is to blame: https://github.com/pytest-dev/pytest-forked/blob/master/testing/conftest.py
Apparently pytest-forked patches atexit
, but in a way that doesn't work when trying to call a function with arguments.
Tried a quick fix:
diff --git i/testing/conftest.py w/testing/conftest.py
index 745c00f..e8343a4 100644
--- i/testing/conftest.py
+++ w/testing/conftest.py
@@ -4,6 +4,17 @@ import pytest
pytest_plugins = "pytester"
+class AtExitFunc:
+
+ def __init__(self, func, *args, **kwargs):
+ self.func = func
+ self.args = args
+ self.kwargs = kwargs
+
+ def __call__(self):
+ self.func(*self.args, **self.kwargs)
+
+
@pytest.fixture(autouse=True)
def _divert_atexit(request, monkeypatch):
import atexit
@@ -13,5 +24,6 @@ def _divert_atexit(request, monkeypatch):
while atexit_fns:
atexit_fns.pop()()
- monkeypatch.setattr(atexit, "register", atexit_fns.append)
+ monkeypatch.setattr(atexit, "register", lambda func, *args, **kwargs:
+ atexit_fns.append(AtExitFunc(func, *args, **kwargs)))
request.addfinalizer(finish)
but I can't seem to successfully run the tests locally, so it'd be good if someone else could pick this up.
If anybody sends this as a PR, we'll see if it explodes in the current CI setup...
/me needs to add a toxenv hitting pytest master...
I suppose the CI setup doesn't tell the whole story as it doesn't actually test against pytest 6. I suppose having the pytest-latest
environment use pip_pre = True
to test against the prerelease would help?
Yeah, I guess there should be pytest-latest + pytest-stable + pytest-unstable
$ tox -e py38-pytestlatest --pre
py38-pytestlatest inst-nodeps: .../pytest-forked/.tox/.tmp/package/1/pytest-forked-1.2.1.dev4+gb29c386.d20200723.tar.gz
py38-pytestlatest installed: attrs==19.3.0,iniconfig==1.0.0,more-itertools==8.4.0,packaging==20.4,pluggy==0.13.1,py==1.9.0,pycmd==1.2,pyparsing==3.0.0a2,pytest==6.0.0rc1,pytest-forked==1.2.1.dev4+gb29c386.d20200723,setuptools-scm==4.1.2,six==1.15.0,toml==0.10.1
py38-pytestlatest run-test-pre: PYTHONHASHSEED='1380079911'
py38-pytestlatest run-test: commands[0] | pytest
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
cachedir: .tox/py38-pytestlatest/.pytest_cache
rootdir: .../pytest-forked, configfile: tox.ini
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 10 items
testing/test_boxed.py FFFxx. [ 60%]
testing/test_xfail_behavior.py FFFF [100%]
=================================== FAILURES ===================================
____________________________ test_functional_boxed _____________________________
testdir = <Testdir local('/tmp/pytest-of-churchyard/pytest-60/test_functional_boxed0')>
@needsfork
def test_functional_boxed(testdir):
p1 = testdir.makepyfile("""
import os
def test_function():
os.kill(os.getpid(), 15)
""")
result = testdir.runpytest(p1, "--forked")
> result.stdout.fnmatch_lines([
"*CRASHED*",
"*1 failed*"
])
E Failed: nomatch: '*CRASHED*'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1'
E and: 'rootdir: /tmp/pytest-of-churchyard/pytest-60/test_functional_boxed0'
E and: 'plugins: forked-1.2.1.dev4+gb29c386.d20200723'
E and: 'collected 1 item'
E and: 'INTERNALERROR> Traceback (most recent call last):'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session'
E and: 'INTERNALERROR> session.exitstatus = doit(config, session) or 0'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main'
E and: 'INTERNALERROR> config.hook.pytest_runtestloop(session=session)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop'
E and: 'INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol'
E and: 'INTERNALERROR> reports = forked_run_report(item)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report'
E and: 'INTERNALERROR> return [report_process_crash(item, result)]'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash'
E and: 'INTERNALERROR> from _pytest._code.source import getfslineno'
E and: "INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)"
E and: ''
E and: '============================ no tests ran in 0.02s ============================='
E remains unmatched: '*CRASHED*'
.../pytest-forked/testing/test_boxed.py:16: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/pytest-of-churchyard/pytest-60/test_functional_boxed0
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 1 item
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol
INTERNALERROR> reports = forked_run_report(item)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report
INTERNALERROR> return [report_process_crash(item, result)]
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash
INTERNALERROR> from _pytest._code.source import getfslineno
INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)
============================ no tests ran in 0.02s =============================
________________________ test_functional_boxed_per_test ________________________
testdir = <Testdir local('/tmp/pytest-of-churchyard/pytest-60/test_functional_boxed_per_test0')>
@needsfork
def test_functional_boxed_per_test(testdir):
p1 = testdir.makepyfile("""
import os
import pytest
@pytest.mark.forked
def test_function():
os.kill(os.getpid(), 15)
""")
result = testdir.runpytest(p1)
> result.stdout.fnmatch_lines([
"*CRASHED*",
"*1 failed*"
])
E Failed: nomatch: '*CRASHED*'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1'
E and: 'rootdir: /tmp/pytest-of-churchyard/pytest-60/test_functional_boxed_per_test0'
E and: 'plugins: forked-1.2.1.dev4+gb29c386.d20200723'
E and: 'collected 1 item'
E and: 'INTERNALERROR> Traceback (most recent call last):'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session'
E and: 'INTERNALERROR> session.exitstatus = doit(config, session) or 0'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main'
E and: 'INTERNALERROR> config.hook.pytest_runtestloop(session=session)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop'
E and: 'INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol'
E and: 'INTERNALERROR> reports = forked_run_report(item)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report'
E and: 'INTERNALERROR> return [report_process_crash(item, result)]'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash'
E and: 'INTERNALERROR> from _pytest._code.source import getfslineno'
E and: "INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)"
E and: ''
E and: '============================ no tests ran in 0.02s ============================='
E remains unmatched: '*CRASHED*'
.../pytest-forked/testing/test_boxed.py:33: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/pytest-of-churchyard/pytest-60/test_functional_boxed_per_test0
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 1 item
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol
INTERNALERROR> reports = forked_run_report(item)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report
INTERNALERROR> return [report_process_crash(item, result)]
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash
INTERNALERROR> from _pytest._code.source import getfslineno
INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)
============================ no tests ran in 0.02s =============================
_____________________ test_functional_boxed_capturing[no] ______________________
testdir = <Testdir local('/tmp/pytest-of-churchyard/pytest-60/test_functional_boxed_capturing0')>
capmode = 'no'
@needsfork
@pytest.mark.parametrize("capmode", [
"no",
pytest.param("sys", marks=pytest.mark.xfail(reason="capture cleanup needed")),
pytest.param("fd", marks=pytest.mark.xfail(reason="capture cleanup needed"))])
def test_functional_boxed_capturing(testdir, capmode):
p1 = testdir.makepyfile("""
import os
import sys
def test_function():
sys.stdout.write("hello\\n")
sys.stderr.write("world\\n")
os.kill(os.getpid(), 15)
""")
result = testdir.runpytest(p1, "--forked", "--capture=%s" % capmode)
> result.stdout.fnmatch_lines("""
*CRASHED*
*stdout*
hello
*stderr*
world
*1 failed*
""")
E Failed: nomatch: '*CRASHED*'
E and: '============================= test session starts =============================='
E and: 'platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1'
E and: 'rootdir: /tmp/pytest-of-churchyard/pytest-60/test_functional_boxed_capturing0'
E and: 'plugins: forked-1.2.1.dev4+gb29c386.d20200723'
E and: 'collected 1 item'
E and: 'INTERNALERROR> Traceback (most recent call last):'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session'
E and: 'INTERNALERROR> session.exitstatus = doit(config, session) or 0'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main'
E and: 'INTERNALERROR> config.hook.pytest_runtestloop(session=session)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop'
E and: 'INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol'
E and: 'INTERNALERROR> reports = forked_run_report(item)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report'
E and: 'INTERNALERROR> return [report_process_crash(item, result)]'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash'
E and: 'INTERNALERROR> from _pytest._code.source import getfslineno'
E and: "INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)"
E and: ''
E and: '============================ no tests ran in 0.02s ============================='
E remains unmatched: '*CRASHED*'
.../pytest-forked/testing/test_boxed.py:54: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/pytest-of-churchyard/pytest-60/test_functional_boxed_capturing0
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 1 item
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol
INTERNALERROR> reports = forked_run_report(item)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report
INTERNALERROR> return [report_process_crash(item, result)]
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash
INTERNALERROR> from _pytest._code.source import getfslineno
INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)
============================ no tests ran in 0.02s =============================
___________________________ test_xfail[strict xfail] ___________________________
is_crashing = True, is_strict = True
testdir = <Testdir local('/tmp/pytest-of-churchyard/pytest-60/test_xfail0')>
@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 = 'test_xfail.py {expected_letter!s}'.format(**locals())
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 = (
'{expected_word!s} test_xfail.py::test_function'.
format(**locals())
)
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 = (
' reason: The process gets terminated; '
'pytest-forked reason: '
'*:*: running the test CRASHED with signal {sig_num:d}'.
format(**locals())
)
total_summary_line = (
'*==== 1 {expected_lowercase!s} in 0.*s* ====*'.
format(**locals())
)
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(
"""
import os
import signal
import pytest
@pytest.mark.xfail(
reason='The process gets terminated',
strict={is_strict!s},
)
@pytest.mark.forked
def test_function():
{test_func_body!s}
""".
format(**locals())
)
pytest_run_result = testdir.runpytest(
test_module,
'-ra',
'-p', 'no:warnings', # the current implementation emits RuntimeWarning
)
> 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.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1'
E and: 'rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail0'
E fnmatch: 'plugins: forked*'
E with: 'plugins: forked-1.2.1.dev4+gb29c386.d20200723'
E exact match: 'collected 1 item'
E nomatch: 'test_xfail.py x'
E and: 'INTERNALERROR> Traceback (most recent call last):'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session'
E and: 'INTERNALERROR> session.exitstatus = doit(config, session) or 0'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main'
E and: 'INTERNALERROR> config.hook.pytest_runtestloop(session=session)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop'
E and: 'INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol'
E and: 'INTERNALERROR> reports = forked_run_report(item)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report'
E and: 'INTERNALERROR> return [report_process_crash(item, result)]'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash'
E and: 'INTERNALERROR> from _pytest._code.source import getfslineno'
E and: "INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)"
E and: ''
E and: '============================ no tests ran in 0.02s ============================='
E remains unmatched: 'test_xfail.py x'
.../pytest-forked/testing/test_xfail_behavior.py:131: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail0
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 1 item
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol
INTERNALERROR> reports = forked_run_report(item)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report
INTERNALERROR> return [report_process_crash(item, result)]
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash
INTERNALERROR> from _pytest._code.source import getfslineno
INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)
============================ no tests ran in 0.02s =============================
___________________________ test_xfail[strict xpass] ___________________________
is_crashing = False, is_strict = True
testdir = <Testdir local('/tmp/pytest-of-churchyard/pytest-60/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 = 'test_xfail.py {expected_letter!s}'.format(**locals())
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 = (
'{expected_word!s} test_xfail.py::test_function'.
format(**locals())
)
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 = (
' reason: The process gets terminated; '
'pytest-forked reason: '
'*:*: running the test CRASHED with signal {sig_num:d}'.
format(**locals())
)
total_summary_line = (
'*==== 1 {expected_lowercase!s} in 0.*s* ====*'.
format(**locals())
)
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(
"""
import os
import signal
import pytest
@pytest.mark.xfail(
reason='The process gets terminated',
strict={is_strict!s},
)
@pytest.mark.forked
def test_function():
{test_func_body!s}
""".
format(**locals())
)
pytest_run_result = testdir.runpytest(
test_module,
'-ra',
'-p', 'no:warnings', # the current implementation emits RuntimeWarning
)
> 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.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1'
E and: 'rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail1'
E fnmatch: 'plugins: forked*'
E with: 'plugins: forked-1.2.1.dev4+gb29c386.d20200723'
E exact match: 'collected 1 item'
E nomatch: 'test_xfail.py F'
E and: 'F'
E and: '=================================== FAILURES ==================================='
E and: '________________________________ test_function _________________________________'
E and: '[XPASS(strict)] The process gets terminated'
E and: '=========================== short test summary info ============================'
E and: 'FAILED test_xfail.py::test_function'
E and: '============================== 1 failed in 0.02s ==============================='
E remains unmatched: 'test_xfail.py F'
.../pytest-forked/testing/test_xfail_behavior.py:131: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail1
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 1 item
F
=================================== FAILURES ===================================
________________________________ test_function _________________________________
[XPASS(strict)] The process gets terminated
=========================== short test summary info ============================
FAILED test_xfail.py::test_function
============================== 1 failed in 0.02s ===============================
_________________________ test_xfail[non-strict xfail] _________________________
is_crashing = True, is_strict = False
testdir = <Testdir local('/tmp/pytest-of-churchyard/pytest-60/test_xfail2')>
@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 = 'test_xfail.py {expected_letter!s}'.format(**locals())
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 = (
'{expected_word!s} test_xfail.py::test_function'.
format(**locals())
)
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 = (
' reason: The process gets terminated; '
'pytest-forked reason: '
'*:*: running the test CRASHED with signal {sig_num:d}'.
format(**locals())
)
total_summary_line = (
'*==== 1 {expected_lowercase!s} in 0.*s* ====*'.
format(**locals())
)
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(
"""
import os
import signal
import pytest
@pytest.mark.xfail(
reason='The process gets terminated',
strict={is_strict!s},
)
@pytest.mark.forked
def test_function():
{test_func_body!s}
""".
format(**locals())
)
pytest_run_result = testdir.runpytest(
test_module,
'-ra',
'-p', 'no:warnings', # the current implementation emits RuntimeWarning
)
> 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.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1'
E and: 'rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail2'
E fnmatch: 'plugins: forked*'
E with: 'plugins: forked-1.2.1.dev4+gb29c386.d20200723'
E exact match: 'collected 1 item'
E nomatch: 'test_xfail.py x'
E and: 'INTERNALERROR> Traceback (most recent call last):'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session'
E and: 'INTERNALERROR> session.exitstatus = doit(config, session) or 0'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main'
E and: 'INTERNALERROR> config.hook.pytest_runtestloop(session=session)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop'
E and: 'INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__'
E and: 'INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec'
E and: 'INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call'
E and: 'INTERNALERROR> result = func()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>'
E and: 'INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>'
E and: 'INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall('
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall'
E and: 'INTERNALERROR> return outcome.get_result()'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result'
E and: 'INTERNALERROR> raise ex[1].with_traceback(ex[2])'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall'
E and: 'INTERNALERROR> res = hook_impl.function(*args)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol'
E and: 'INTERNALERROR> reports = forked_run_report(item)'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report'
E and: 'INTERNALERROR> return [report_process_crash(item, result)]'
E and: 'INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash'
E and: 'INTERNALERROR> from _pytest._code.source import getfslineno'
E and: "INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)"
E and: ''
E and: '============================ no tests ran in 0.02s ============================='
E remains unmatched: 'test_xfail.py x'
.../pytest-forked/testing/test_xfail_behavior.py:131: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail2
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 1 item
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 240, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 296, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/main.py", line 321, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/hooks.py", line 286, in __call__
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 93, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 337, in traced_hookexec
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 52, in from_call
INTERNALERROR> result = func()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 335, in <lambda>
INTERNALERROR> outcome = _Result.from_call(lambda: oldcall(hook, hook_impls, kwargs))
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/manager.py", line 84, in <lambda>
INTERNALERROR> self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR> return outcome.get_result()
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR> raise ex[1].with_traceback(ex[2])
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 44, in pytest_runtest_protocol
INTERNALERROR> reports = forked_run_report(item)
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 72, in forked_run_report
INTERNALERROR> return [report_process_crash(item, result)]
INTERNALERROR> File ".../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/pytest_forked/__init__.py", line 76, in report_process_crash
INTERNALERROR> from _pytest._code.source import getfslineno
INTERNALERROR> ImportError: cannot import name 'getfslineno' from '_pytest._code.source' (.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/_code/source.py)
============================ no tests ran in 0.02s =============================
_________________________ test_xfail[non-strict xpass] _________________________
is_crashing = False, is_strict = False
testdir = <Testdir local('/tmp/pytest-of-churchyard/pytest-60/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 = 'test_xfail.py {expected_letter!s}'.format(**locals())
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 = (
'{expected_word!s} test_xfail.py::test_function'.
format(**locals())
)
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 = (
' reason: The process gets terminated; '
'pytest-forked reason: '
'*:*: running the test CRASHED with signal {sig_num:d}'.
format(**locals())
)
total_summary_line = (
'*==== 1 {expected_lowercase!s} in 0.*s* ====*'.
format(**locals())
)
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(
"""
import os
import signal
import pytest
@pytest.mark.xfail(
reason='The process gets terminated',
strict={is_strict!s},
)
@pytest.mark.forked
def test_function():
{test_func_body!s}
""".
format(**locals())
)
pytest_run_result = testdir.runpytest(
test_module,
'-ra',
'-p', 'no:warnings', # the current implementation emits RuntimeWarning
)
> 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.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1'
E and: 'rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail3'
E fnmatch: 'plugins: forked*'
E with: 'plugins: forked-1.2.1.dev4+gb29c386.d20200723'
E exact match: 'collected 1 item'
E nomatch: 'test_xfail.py X'
E and: 'X'
E and: '=========================== short test summary info ============================'
E and: 'XPASS test_xfail.py::test_function The process gets terminated'
E and: '============================== 1 xpassed in 0.02s =============================='
E remains unmatched: 'test_xfail.py X'
.../pytest-forked/testing/test_xfail_behavior.py:131: Failed
----------------------------- Captured stdout call -----------------------------
============================= test session starts ==============================
platform linux -- Python 3.8.5, pytest-6.0.0rc1, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/pytest-of-churchyard/pytest-60/test_xfail3
plugins: forked-1.2.1.dev4+gb29c386.d20200723
collected 1 item
X
=========================== short test summary info ============================
XPASS test_xfail.py::test_function The process gets terminated
============================== 1 xpassed in 0.02s ==============================
=============================== warnings summary ===============================
testing/test_boxed.py::test_functional_boxed
testing/test_boxed.py::test_functional_boxed_per_test
testing/test_boxed.py::test_functional_boxed_capturing[no]
testing/test_boxed.py::test_functional_boxed_capturing[sys]
testing/test_boxed.py::test_functional_boxed_capturing[fd]
testing/test_xfail_behavior.py::test_xfail[strict xfail]
testing/test_xfail_behavior.py::test_xfail[strict xpass]
testing/test_xfail_behavior.py::test_xfail[non-strict xfail]
testing/test_xfail_behavior.py::test_xfail[non-strict xpass]
.../pytest-forked/.tox/py38-pytestlatest/lib/python3.8/site-packages/_pytest/compat.py:340: PytestDeprecationWarning: The TerminalReporter.writer attribute is deprecated, use TerminalReporter._tw instead at your own risk.
See https://docs.pytest.org/en/stable/deprecations.html#terminalreporter-writer for more information.
return getattr(object, name, default)
-- Docs: https://docs.pytest.org/en/stable/warnings.html
=========================== short test summary info ============================
FAILED testing/test_boxed.py::test_functional_boxed - Failed: nomatch: '*CRAS...
FAILED testing/test_boxed.py::test_functional_boxed_per_test - Failed: nomatc...
FAILED testing/test_boxed.py::test_functional_boxed_capturing[no] - Failed: n...
FAILED testing/test_xfail_behavior.py::test_xfail[strict xfail] - Failed: fnm...
FAILED testing/test_xfail_behavior.py::test_xfail[strict xpass] - Failed: fnm...
FAILED testing/test_xfail_behavior.py::test_xfail[non-strict xfail] - Failed:...
FAILED testing/test_xfail_behavior.py::test_xfail[non-strict xpass] - Failed:...
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
============== 7 failed, 1 passed, 2 xfailed, 9 warnings in 0.85s ==============
ERROR: InvocationError for command .../pytest-forked/.tox/py38-pytestlatest/bin/pytest (exited with code 1)
___________________________________ summary ____________________________________
ERROR: py38-pytestlatest: commands failed
@hroncok I assume this is after my patch above? Looks like pytest-forked is using private pytest APIs which moved around with 6.0. I assume adjusting the import to do from _pytest._code import getfslineno
(which should work with both pytest 5 and 6?) will help. I'm afraid I won't have the time to continue looking at this, as I've never used this plugin and should take care of some non-pytest things :)
I assume this is after my patch above?
Indeed.
I am taking @The-Compiler's work and will submit a PR. There are other failures afterwards which I'm still working on.
@bluetech great! Feel free to submit a draft PR so that any WIP failures are visible in the CI logs.
Hello, this is pytest-forked @ b29c386777b09b59e24c0488351ccd505755c8fa:
Not sure if this is a pytest bug or pytest-forked needs to change something. The traceback mostly shows pytest code only :/