conftest   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 5

2 Functions

Rating   Name   Duplication   Size   Complexity  
A pytest_collection_modifyitems() 0 6 4
A pytest_addoption() 0 6 1
1
import pytest
2
3
4
def pytest_addoption(parser):
5
	parser.addoption(
6
		"--run-online",
7
		action="store_true",
8
		default=False,
9
		help="Run online tests",
10
	)
11
12
13
def pytest_collection_modifyitems(config, items):
14
	if not config.getoption("--run-online"):
15
		skipper = pytest.mark.skip(reason="Only run when --run-online is given")
16
		for item in items:
17
			if "online" in item.keywords:
18
				item.add_marker(skipper)
19