Skip to content

Commit 82ca8b0

Browse files
author
Jan Musial
committed
Mark all tests in security directory as security
Signed-off-by: Jan Musial <[email protected]>
1 parent 4690cd6 commit 82ca8b0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

tests/functional/pytest.ini

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[pytest]
22
markers =
3-
security: security objectives coverage
3+
security: security objectives coverage, do not run by default
44
long: long, do not run by default
5-
addopts = --ignore=tests/security -m "not long"
5+
addopts = -m "not long and not security"

tests/functional/tests/security/conftest.py

+9
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
c_uint16,
1212
c_int
1313
)
14+
from pathlib import Path
1415
from tests.utils.random import RandomStringGenerator, RandomGenerator, DefaultRanges, Range
1516

1617
from pyocf.types.cache import CacheMode, MetadataLayout, PromotionPolicy
@@ -21,6 +22,14 @@
2122
sys.path.append(os.path.join(os.path.dirname(__file__), os.path.pardir))
2223

2324

25+
def pytest_collection_modifyitems(session, config, items):
26+
base_dir = Path(config.rootdir)
27+
for item in items:
28+
rel_path = Path(item.fspath).relative_to(base_dir)
29+
if rel_path.match("*/security/*"):
30+
item.add_marker(pytest.mark.security)
31+
32+
2433
def enum_min(enum):
2534
return list(enum)[0].value
2635

0 commit comments

Comments
 (0)