File: conftest.py

package info (click to toggle)
python-semantic-release 10.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,112 kB
  • sloc: python: 36,523; sh: 340; makefile: 156
file content (16 lines) | stat: -rw-r--r-- 554 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from __future__ import annotations

from pathlib import Path

import pytest


@pytest.hookimpl(tryfirst=True)
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
    """Apply the unit marker to all tests in the unit test directory."""
    unit_test_directory = Path(__file__).parent
    for item in items:
        if unit_test_directory in item.path.parents:
            item.add_marker(pytest.mark.unit)
            if "order" not in [mark.name for mark in item.own_markers]:
                item.add_marker(pytest.mark.order("first"))