Skip to content
This repository has been archived by the owner on May 27, 2024. It is now read-only.

Internal error encountered even with an empty test #19

Closed
roastduck opened this issue Apr 3, 2019 · 4 comments
Closed

Internal error encountered even with an empty test #19

roastduck opened this issue Apr 3, 2019 · 4 comments

Comments

@roastduck
Copy link

I failed to run even an empty test case.

The output is:

========================================================= test session starts =========================================================
platform linux -- Python 3.5.2, pytest-4.4.0, py-1.8.0, pluggy-0.9.0
rootdir: /home/rd/tmp
plugins: mp-0.0.4, hypothesis-3.44.23
collected 1 item
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/_pytest/main.py", line 209, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/_pytest/main.py", line 249, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pluggy/hooks.py", line 289, in __call__
INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pluggy/manager.py", line 68, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pluggy/manager.py", line 62, in <lambda>
INTERNALERROR>     firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pluggy/callers.py", line 208, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pluggy/callers.py", line 80, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pluggy/callers.py", line 187, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pytest_mp/plugin.py", line 328, in pytest_runtestloop
INTERNALERROR>     batches = batch_tests(session)
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pytest_mp/plugin.py", line 149, in batch_tests
INTERNALERROR>     group_name, group_strategy = get_item_batch_name_and_strategy(item)
INTERNALERROR>   File "/home/rd/.local/lib/python3.5/site-packages/pytest_mp/plugin.py", line 115, in get_item_batch_name_and_strategy
INTERNALERROR>     marker = item.get_marker('mp_group')
INTERNALERROR> AttributeError: 'Function' object has no attribute 'get_marker'

==================================================== no tests ran in 0.02 seconds =====================================================

There's only test_search.py and an empty __init__.py in the directory test.

The content of test/test_search.py is:

def test_foo():
    pass
@kdelee
Copy link
Member

kdelee commented May 9, 2019

@roastduck can you tell me your python version and pytest version? I believe this is related to updates made to get up to date with pytest 4.0+
Also see jlaska/pytest-github#24 (comment)

@roastduck
Copy link
Author

I'm using PyTest 4.4.0, so it's not the problem. The detailed version string is:

This is pytest version 4.4.0, imported from /home/rd/.local/lib/python3.5/site-packages/pytest.py
setuptools registered plugins:
  hypothesis-3.44.23 at /home/rd/.local/lib/python3.5/site-packages/hypothesis/extra/pytestplugin.py

@kdelee
Copy link
Member

kdelee commented May 15, 2019

I am not able to reproduce @roastduck.
Also, not sure why pytest-mp is not in your list of registered plugins. Did you pip install it?

Here's my workflow:

virtualenv -p python3 ~/venvs/testpytestmp
source ~/venvs/testpytestmp/bin/activate
git clone git@github.com:ansible/pytest-mp.git
pip install -e pytest-mp
echo -e "def test_foo():\n    assert True" > test.py
py.test test.py

My output of py.test --version:

This is pytest version 4.5.0, imported from /home/elijah/venvs/testpytestmp/lib/python3.7/site-packages/pytest.py
setuptools registered plugins:
  pytest-mp-0.0.4 at /home/elijah/sfw/ansible/pytest-mp/pytest_mp/plugin.py

I now do see in your original comment that you were using a more up to date version of pytest. Have you attemped a fresh install of pytest-mp from git?

@roastduck
Copy link
Author

pytest-mp was missing from what I posted above. It was simply because I found pytest-mp not working and uninstalled it.

The problematic version was installed via pip. Now I installed the git version and all things work fine. Maybe the problem was within pip and maybe not. Anyway thank you for your help. I'm closing this issue.

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

No branches or pull requests

2 participants