Skip to content

Commit

Permalink
Add option --no_parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
drew2a committed Mar 3, 2022
1 parent 6736035 commit fd614dd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/tribler-core/tribler_core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,3 +310,21 @@ async def download_manager(tmp_path_factory):
download_manager.initialize()
yield download_manager
await download_manager.shutdown()


def pytest_addoption(parser):
# Documentation on pytest, "how to skip a test":
# https://docs.pytest.org/en/6.2.x/example/simple.html#control-skipping-of-tests-according-to-command-line-option
parser.addoption('--no_parallel', action='store_true', dest="no_parallel",
default=False, help="run no_parallel tests")


def pytest_collection_modifyitems(config, items):
# Documentation on pytest, "how to skip a test":
# https://docs.pytest.org/en/6.2.x/example/simple.html#control-skipping-of-tests-according-to-command-line-option
if config.getoption("--no_parallel"):
return
skip = pytest.mark.skip(reason="need --no_parallel option to run")
for item in items:
if "no_parallel" in item.keywords:
item.add_marker(skip)

0 comments on commit fd614dd

Please sign in to comment.