Skip to content

Pytest function "pytest_pyfunc_call()" throws "KeyError" when executed the test in parallel mode #3400

Closed
@umasenthil

Description

@umasenthil

Error during parallel execution: (I ran the command : python3 -m pytest tests/statistics)
Error:
pyfuncitem = <Function 'test_coxph'>

@hookimpl(trylast=True)
def pytest_pyfunc_call(pyfuncitem):
testfunction = pyfuncitem.obj
if pyfuncitem._isyieldedfunction():
testfunction(*pyfuncitem._args)
else:
funcargs = pyfuncitem.funcargs
testargs = {}
for arg in pyfuncitem._fixtureinfo.argnames:
testargs[arg] = funcargs[arg]
E KeyError: 'flchain'

../../mypythonenv/lib/python3.6/site-packages/_pytest/python.py:154: KeyError

It works if I run the same test sequentially

The pytest hook that I have in conftest.py for parallel exection:

def pytest_collection_modifyitems(items):
    numrepeats = 2
    items.extend(items * (numrepeats -1))

Environment:
apipkg (1.4)
asn1crypto (0.24.0)
attrs (17.4.0)
bcrypt (3.1.4)
boto3 (1.6.11)
botocore (1.9.11)
certifi (2018.1.18)
cffi (1.11.5)
chardet (3.0.4)
cryptography (2.1.4)
docutils (0.14)
execnet (1.5.0)
idna (2.6)
jmespath (0.9.3)
jproperties3 (0.5.2)
numpy (1.14.1)
pandas (0.22.0)
paramiko (2.4.1)
pbr (4.0.2)
pip (9.0.1)
pluggy (0.6.0)
psutil (5.4.3)
py (1.5.2)
pyasn1 (0.4.2)
pycparser (2.18)
PyNaCl (1.2.1)
pytest (3.4.2)
pytest-concurrent (0.1.2)
pytest-forked (0.2)
pytest-xdist (1.22.2)
python-dateutil (2.6.1)
pytz (2018.3)
requests (2.18.4)
s3transfer (0.1.13)
setuptools (38.5.2)
six (1.11.0)
SQLAlchemy (1.2.5)
sqlalchemy-teradata (0.0.9.dev0)
stevedore (1.28.0)
tdtestpy (0.1.3)
tdutils (0.0.0)
teradata (15.10.0.21)
urllib3 (1.22)
virtualenv (15.2.0)
virtualenv-clone (0.3.0)
virtualenvwrapper (4.8.2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs informationreporter needs to provide more information; can be closed after 2 or more weeks of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions