Ignore DoctestTextfile when collecting

Prevents this error:

    $ tox -e py27 -- -m unit
    ...
    INTERNALERROR>   File "/Users/marca/dev/git-repos/pip/tests/conftest.py", line 16, in pytest_collection_modifyitems
    INTERNALERROR>     item.module.__file__,
    INTERNALERROR> AttributeError: 'DoctestTextfile' object has no attribute 'module'
This commit is contained in:
Marc Abramowitz 2015-03-19 14:24:25 -07:00
parent 3b14a4f0e5
commit 60d09fe748
1 changed files with 2 additions and 0 deletions

View File

@ -12,6 +12,8 @@ from tests.lib.venv import VirtualEnvironment
def pytest_collection_modifyitems(items):
for item in items:
if not hasattr(item, 'module'): # e.g.: DoctestTextfile
continue
module_path = os.path.relpath(
item.module.__file__,
os.path.commonprefix([__file__, item.module.__file__]),