File: conftest.py

package info (click to toggle)
reprotest 0.7.32
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 548 kB
  • sloc: python: 5,064; makefile: 47; sh: 29
file content (26 lines) | stat: -rw-r--r-- 691 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import distro
import pytest

SUPPORTED_DIST = ["debian", "fedora"]


def pytest_configure(config):
    config.addinivalue_line(
        "markers", "need_builddeps: need need_builddeps"
    )
    config.addinivalue_line(
        "markers", "debian: filter tests for debian only"
    )
    config.addinivalue_line(
        "markers", "fedora: filter tests for fedora only"
    )


def pytest_runtest_setup(item):
    # get current dist
    dist = distro.id()
    # filter markers
    supported_dist = set(SUPPORTED_DIST).intersection(
        mark.name for mark in item.iter_markers())
    if supported_dist and dist not in supported_dist:
        pytest.skip("cannot run on {}".format(dist))