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

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

Closed
umasenthil opened this issue Apr 13, 2018 · 3 comments
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity

Comments

@umasenthil
Copy link

umasenthil commented Apr 13, 2018

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)

@pytestbot
Copy link
Contributor

GitMate.io thinks possibly related issues are #231 (Duplicate function "pytest_pyfunc_call"), #3128 (pytest.main function gives an error when tested module is in the PYTHONPATH), #1563 (All pytest tests skipped), #2137 (pytest --pdb execute test cases which otherwise are skipped), and #342 (pytest is identifying a function as a test case that shouldn't be).

@RonnyPfannschmidt RonnyPfannschmidt added the status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity label Apr 13, 2018
@RonnyPfannschmidt
Copy link
Member

please format your code listings as code and shoiw waht you run, also your conftests might be of help

@pytestbot pytestbot added type: bug problem that needs to be addressed and removed status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity labels Apr 13, 2018
@nicoddemus nicoddemus added status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity and removed type: bug problem that needs to be addressed labels Apr 13, 2018
@Zac-HD
Copy link
Member

Zac-HD commented Oct 20, 2018

Closing because there is no reproducible example of the problem.

@Zac-HD Zac-HD closed this as completed Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs information reporter needs to provide more information; can be closed after 2 or more weeks of inactivity
Projects
None yet
Development

No branches or pull requests

5 participants