Skip to content

pytest --randomly-dont-reorganize failing with pytest-pylint #86

@majuscule

Description

@majuscule

pytest-randomly seems to conflict with pytest-pylint when used with the randomly flag. I have attached a full console log that demonstrates the problem. Please let me know if there is anything else I can provide to help figure out what's going on. I've spent some time looking through pytest_collection_modifyitems, but I'm not sure what the root cause is.

~/t/randomly-debug
❯ ls -a
.      ..     sample
~/t/randomly-debug
❯ tree sample
sample
├── __init__.py
└── test
    └── test_randomly.py

1 directory, 2 files
~/t/randomly-debug
❯ cat sample/__init__.py
~/t/randomly-debug
❯ cat sample/test/test_randomly.py
"""docstring"""
def test_randomly_interaction():
    """docstring"""
    return True
~/t/randomly-debug
❯ virtualenv venv
New python executable in /Users/dylan.lloyd/t/randomly-debug/venv/bin/python2.7
Also creating executable in /Users/dylan.lloyd/t/randomly-debug/venv/bin/python
Please make sure you remove any previous custom paths from your /Users/dylan.lloyd/.pydistutils.cfg file.
Installing setuptools, pip, wheel...done.
~/t/randomly-debug
❯ ./venv/bin/pip install pylint==1.6.0 pytest==3.0.7 pytest-pylint==0.6.0
Collecting pylint==1.6.0
  Using cached pylint-1.6.0-py2.py3-none-any.whl
Collecting pytest==3.0.7
  Using cached pytest-3.0.7-py2.py3-none-any.whl
Collecting pytest-pylint==0.6.0
  Using cached pytest_pylint-0.6.0-py2-none-any.whl
Collecting six (from pylint==1.6.0)
  Using cached six-1.11.0-py2.py3-none-any.whl
Collecting isort>=4.2.5 (from pylint==1.6.0)
  Using cached isort-4.2.15-py2.py3-none-any.whl
Collecting mccabe (from pylint==1.6.0)
  Using cached mccabe-0.6.1-py2.py3-none-any.whl
Collecting colorama (from pylint==1.6.0)
  Using cached colorama-0.3.9-py2.py3-none-any.whl
Collecting astroid<1.5.0,>=1.4.5 (from pylint==1.6.0)
  Using cached astroid-1.4.9-py2.py3-none-any.whl
Requirement already satisfied: setuptools in ./venv/lib/python2.7/site-packages (from pytest==3.0.7)
Collecting py>=1.4.29 (from pytest==3.0.7)
  Using cached py-1.4.34-py2.py3-none-any.whl
Collecting wrapt (from astroid<1.5.0,>=1.4.5->pylint==1.6.0)
Collecting lazy-object-proxy (from astroid<1.5.0,>=1.4.5->pylint==1.6.0)
Installing collected packages: six, isort, mccabe, colorama, wrapt, lazy-object-proxy, astroid, pylint, py, pytest, pytest-pylint
Successfully installed astroid-1.4.9 colorama-0.3.9 isort-4.2.15 lazy-object-proxy-1.3.1 mccabe-0.6.1 py-1.4.34 pylint-1.6.0 pytest-3.0.7 pytest-pylint-0.6.0 six-1.11.0 wrapt-1.10.11
~/t/randomly-debug
❯ ./venv/bin/pytest sample/test/test_randomly.py --pylint sample/__init__.py
=================================== test session starts ====================================
platform darwin -- Python 2.7.12, pytest-3.0.7, py-1.4.34, pluggy-0.4.0
rootdir: /Users/dylan.lloyd/t/randomly-debug, inifile:
plugins: pylint-0.6.0
collected 3 items

sample/test/test_randomly.py ..
sample/__init__.py .

================================= 3 passed in 0.11 seconds =================================
~/t/randomly-debug
❯ ./venv/bin/pip install pytest-randomly==1.2.1
Collecting pytest-randomly==1.2.1
  Using cached pytest_randomly-1.2.1-py2.py3-none-any.whl
Requirement already satisfied: pytest in ./venv/lib/python2.7/site-packages (from pytest-randomly==1.2.1)
Requirement already satisfied: setuptools in ./venv/lib/python2.7/site-packages (from pytest->pytest-randomly==1.2.1)
Requirement already satisfied: py>=1.4.29 in ./venv/lib/python2.7/site-packages (from pytest->pytest-randomly==1.2.1)
Installing collected packages: pytest-randomly
Successfully installed pytest-randomly-1.2.1
~/t/randomly-debug
❯ ./venv/bin/pytest sample/test/test_randomly.py --pylint sample/__init__.py
=================================== test session starts ====================================
platform darwin -- Python 2.7.12, pytest-3.0.7, py-1.4.34, pluggy-0.4.0
Using --randomly-seed=1509722578
rootdir: /Users/dylan.lloyd/t/randomly-debug, inifile:
plugins: randomly-1.2.1, pylint-0.6.0
collected 3 items
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/main.py", line 98, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/main.py", line 132, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/main.py", line 141, in pytest_collection
INTERNALERROR>     return session.perform_collect()
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/main.py", line 602, in perform_collect
INTERNALERROR>     config=self.config, items=items)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 745, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 339, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 334, in <lambda>
INTERNALERROR>     _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/_pytest/vendored_packages/pluggy.py", line 614, in execute
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/Users/dylan.lloyd/t/randomly-debug/venv/lib/python2.7/site-packages/pytest_randomly.py", line 119, in pytest_collection_modifyitems
INTERNALERROR>     current_module = item.module
INTERNALERROR> AttributeError: 'PyLintItem' object has no attribute 'module'

=============================== no tests ran in 0.01 seconds ===============================
~/t/randomly-debug
❯ ./venv/bin/pytest sample/test/test_randomly.py --pylint sample/__init__.py --randomly-dont-reorganize
================================================================================= test session starts ==================================================================================
platform darwin -- Python 2.7.12, pytest-3.0.7, py-1.4.34, pluggy-0.4.0
Using --randomly-seed=1509722745
rootdir: /Users/dylan.lloyd/t/randomly-debug, inifile:
plugins: randomly-1.2.1, pylint-0.6.0
collected 3 items

sample/test/test_randomly.py ..
sample/__init__.py .

=============================================================================== 3 passed in 0.10 seconds ===============================================================================

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions