def pytest_collection_modifyitems(self, session, config, items):
env = config.getoption('--env')
# TODO: Really naive, we need add a batch call. Until then,
# this is going to be unworkable for anyone outside the
# Toronto office...
for item in items:
for mark in self.get_marks(env=env, name=item.name):
name = mark['name']
args = mark.get('args', [])
kwargs = mark.get('kwargs', {})
pytest.log.info(
"Applying {} mark to {}".format(name, item.name)
)
mark = getattr(pytest.mark, name)(*args, **kwargs)
item.add_marker(mark)
# Proceed with the collection
yield
评论列表
文章目录