Skip to content

Commit

Permalink
Mark the GitHub integration tests as slow
Browse files Browse the repository at this point in the history
  • Loading branch information
dianaclarke committed Jul 14, 2021
1 parent 1cff7d1 commit 1f1cdd9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
26 changes: 26 additions & 0 deletions conbench/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,29 @@ def client(application):
@pytest.fixture
def runner(application):
return application.test_cli_runner()


def pytest_addoption(parser):
parser.addoption(
"--run-slow",
action="store_true",
default=False,
help="run slow tests",
)


def pytest_configure(config):
config.addinivalue_line(
"markers",
"slow: mark test as slow to run",
)


def pytest_collection_modifyitems(config, items):
if config.getoption("--run-slow"):
return
reason = "need --run-slow option to run"
skip_slow = pytest.mark.skip(reason=reason)
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)
4 changes: 4 additions & 0 deletions conbench/tests/entities/test_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import json
import os

import pytest

from ...entities.commit import GitHub, get_github_commit
from ...tests.api import _fixtures


this_dir = os.path.abspath(os.path.dirname(__file__))


@pytest.mark.slow
def test_get_github_commit():
# NOTE: This integration test intentionally hits GitHub.
# TODO: This test will fail once it's no longer one of the most recent 1000
Expand All @@ -28,6 +31,7 @@ def test_get_github_commit():
assert get_github_commit(repo, sha) == expected


@pytest.mark.slow
def test_get_github_commit_pull_request():
# NOTE: This integration test intentionally hits GitHub.
# TODO: This test will fail once it's no longer one of the most recent 1000
Expand Down

0 comments on commit 1f1cdd9

Please sign in to comment.