Skip to content

Commit

Permalink
Add type annotations to conftest.py (#38691)
Browse files Browse the repository at this point in the history
  • Loading branch information
syedahsn authored Apr 2, 2024
1 parent 62f948c commit 26b5bc9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tests/system/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import itertools
import os
import re
from pathlib import Path
from unittest import mock

import pytest
Expand All @@ -40,18 +39,18 @@ def provider_env_vars():


@pytest.fixture(autouse=True)
def skip_if_env_var_not_set(provider_env_vars):
def skip_if_env_var_not_set(provider_env_vars: list[str]) -> None:
for env in itertools.chain(REQUIRED_ENV_VARS, provider_env_vars):
if env not in os.environ:
pytest.skip(f"Missing required environment variable {env}")
return


def pytest_collection_modifyitems(config, items):
def pytest_collection_modifyitems(config: pytest.Config, items: list[pytest.Item]) -> None:
"""Add @pytest.mark.system(provider_name) for every system test."""
rootdir = Path(config.rootpath)
rootdir = config.rootpath
for item in items:
rel_path = Path(item.path).relative_to(rootdir)
rel_path = item.path.relative_to(rootdir)
match = re.match(".+/system/providers/([^/]+)", str(rel_path))
if match:
provider = match.group(1)
Expand Down

0 comments on commit 26b5bc9

Please sign in to comment.