diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-10-22 02:34:04 +0200 |
---|---|---|
committer | John Villalovos <john@sodarock.com> | 2022-10-27 08:06:52 -0700 |
commit | 0b2f6bcf454685786a89138b36b10fba649663dd (patch) | |
tree | 918f3590dc41fc6fd1db1af76e765f9eb2b5e2ce | |
parent | 8f74a333ada3d819187dec5905aeca1352fba270 (diff) | |
download | gitlab-0b2f6bcf454685786a89138b36b10fba649663dd.tar.gz |
chore: add basic typing to test root
-rw-r--r-- | .pre-commit-config.yaml | 1 | ||||
-rw-r--r-- | pyproject.toml | 2 | ||||
-rw-r--r-- | tests/conftest.py | 15 |
3 files changed, 11 insertions, 7 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 85405e1..02c64e3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,6 +35,7 @@ repos: - id: mypy args: [] additional_dependencies: + - pytest==7.1.3 - types-PyYAML==6.0.12 - types-requests==2.28.11.2 - types-setuptools==64.0.1 diff --git a/pyproject.toml b/pyproject.toml index 42a0241..1ce5e85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -29,9 +29,9 @@ warn_unused_ignores = true module = [ "docs.*", "docs.ext.*", - "tests.*", "tests.functional.*", "tests.functional.api.*", + "tests.meta.*", "tests.unit.*", "tests.smoke.*" ] diff --git a/tests/conftest.py b/tests/conftest.py index 06e99f6..de15d0a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,15 +1,18 @@ +import pathlib + +import _pytest.config import pytest import gitlab @pytest.fixture(scope="session") -def test_dir(pytestconfig): - return pytestconfig.rootdir / "tests" +def test_dir(pytestconfig: _pytest.config.Config) -> pathlib.Path: + return pytestconfig.rootdir / "tests" # type: ignore @pytest.fixture(autouse=True) -def mock_clean_config(monkeypatch): +def mock_clean_config(monkeypatch: pytest.MonkeyPatch) -> None: """Ensures user-defined environment variables do not interfere with tests.""" monkeypatch.delenv("PYTHON_GITLAB_CFG", raising=False) monkeypatch.delenv("GITLAB_PRIVATE_TOKEN", raising=False) @@ -19,13 +22,13 @@ def mock_clean_config(monkeypatch): @pytest.fixture(autouse=True) -def default_files(monkeypatch): +def default_files(monkeypatch: pytest.MonkeyPatch) -> None: """Ensures user configuration files do not interfere with tests.""" monkeypatch.setattr(gitlab.config, "_DEFAULT_FILES", []) @pytest.fixture -def valid_gitlab_ci_yml(): +def valid_gitlab_ci_yml() -> str: return """--- :test_job: :script: echo 1 @@ -33,5 +36,5 @@ def valid_gitlab_ci_yml(): @pytest.fixture -def invalid_gitlab_ci_yml(): +def invalid_gitlab_ci_yml() -> str: return "invalid" |