def pytest_collection_modifyitems(config, items):
"""Hook to prevent run destructive tests without snapshot_name."""
stop_destructive = (config.option.snapshot_name is None and
not config.option.force_destructive)
for item in items:
if item.get_marker(DESTRUCTIVE) and stop_destructive:
pytest.exit("You try to start destructive tests without passing "
"--snapshot-name for cloud reverting. Such tests can "
"break your cloud. To run destructive tests without "
"--snapshot-name you should pass --force-destructive "
"argument.")
评论列表
文章目录