blob: bb8e7ff77f8d0dc89ae28a6aeb293f241f2ac5ce [file] [log] [blame]
Allen Li8c4d01b2017-09-22 13:53:16 -07001# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5"""pytest extensions."""
6
7from __future__ import absolute_import
8from __future__ import division
9from __future__ import print_function
10
11import pytest
12
13
14def pytest_addoption(parser):
15 """Add extra pytest options."""
16 parser.addoption("--skipslow", action="store_true",
17 default=False, help="Skip slow tests")
18
19
20def pytest_collection_modifyitems(config, items):
21 """Modify tests to remove slow tests if --skipslow was passed."""
Allen Li2678d362017-10-11 16:59:07 -070022 if config.getoption("--skipslow"): # pragma: no cover
Allen Li8c4d01b2017-09-22 13:53:16 -070023 skip_slow = pytest.mark.skip(reason="--skipslow option was passed")
24 for item in items:
25 if "slow" in item.keywords:
26 item.add_marker(skip_slow)