Exemplo n.º 1
0
def pytest_runtest_setup(item: Item) -> None:
    env = Env()

    if item.get_closest_marker("k8s") and not env.bool("TEST_CLUSTER_ACTIVE", False):
        pytest.skip("test requires TEST_CLUSTER_ACTIVE to be true")

    if item.get_closest_marker("docker") and not env.bool("TEST_DOCKER_ACTIVE", False):
        pytest.skip("test requires TEST_DOCKER_ACTIVE to be true")

    if item.get_closest_marker("vault") and not env.bool("TEST_VAULT_ACTIVE", False):
        pytest.skip("test requires TEST_VAULT_ACTIVE to be true")
Exemplo n.º 2
0
def pytest_runtest_setup(item: Item):
    """skip runalone test when global run"""

    if item.get_closest_marker("runalone"):
        name = re.match(r"test_([^\[]+)", item.name).group()
        if not item.config.args or not any(
                re.match(fr".*\:\:{name}", arg) for arg in item.config.args):
            pytest.skip(msg="should run alone")
Exemplo n.º 3
0
 def _get_xray_marker(item: Item) -> Optional[Mark]:
     return item.get_closest_marker(XRAY_MARKER_NAME)
def _sorting_key(item: Item) -> int:
    if item.get_closest_marker(INTEGRATION_MARKER):
        return 1
    return 0
Exemplo n.º 5
0
    def get(cls, item: PytestItem) -> Optional['Marker']:
        marker = item.get_closest_marker(cls.MARKER_NAME)
        if marker is None:
            return None

        return cls(*(marker.kwargs.get(field) for field in cls.FIELDS))