Closed
Description
Hello,
I have tried to find anything in documentation about hooks and skip, but i was not able to. Calling pytest.skip
in other hooks e.g. pytest_runtest_call
, pytest_generate_tests
or pytest_runtest_setup
skips item fine.
However when called in pytest_itemcollected
i get:
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\main.py", line 98, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\main.py", line 132, in _main
INTERNALERROR> config.hook.pytest_collection(session=session)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 745, in __call__
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 339, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 334, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 614, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\main.py", line 141, in pytest_collection
INTERNALERROR> return session.perform_collect()
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\main.py", line 600, in perform_collect
INTERNALERROR> items = self._perform_collect(args, genitems)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\main.py", line 636, in _perform_collect
INTERNALERROR> self.items.extend(self.genitems(node))
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\main.py", line 772, in genitems
INTERNALERROR> for x in self.genitems(subnode):
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\main.py", line 765, in genitems
INTERNALERROR> node.ihook.pytest_itemcollected(item=node)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 745, in __call__
INTERNALERROR> return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 339, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 334, in <lambda>
INTERNALERROR> _MultiCall(methods, kwargs, hook.spec_opts).execute()
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\vendored_packages\pluggy.py", line 614, in execute
INTERNALERROR> res = hook_impl.function(*args)
INTERNALERROR> File "D:\workspace\sdt\sdt-test\us_test\conftest.py", line 208, in pytest_itemcollected
INTERNALERROR> pytest.skip()
INTERNALERROR> File "...\pytest-3.0.6-py2.7.egg\_pytest\runner.py", line 529, in skip
INTERNALERROR> raise Skipped(msg=msg)
INTERNALERROR> Skipped: <Skipped instance>
Thank you for your time.