Skip to content

Commit 0b2f6bc

Browse files
nejchJohnVillalovos
authored andcommitted
chore: add basic typing to test root
1 parent 8f74a33 commit 0b2f6bc

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ repos:
3535
- id: mypy
3636
args: []
3737
additional_dependencies:
38+
- pytest==7.1.3
3839
- types-PyYAML==6.0.12
3940
- types-requests==2.28.11.2
4041
- types-setuptools==64.0.1

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ warn_unused_ignores = true
2929
module = [
3030
"docs.*",
3131
"docs.ext.*",
32-
"tests.*",
3332
"tests.functional.*",
3433
"tests.functional.api.*",
34+
"tests.meta.*",
3535
"tests.unit.*",
3636
"tests.smoke.*"
3737
]

tests/conftest.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
import pathlib
2+
3+
import _pytest.config
14
import pytest
25

36
import gitlab
47

58

69
@pytest.fixture(scope="session")
7-
def test_dir(pytestconfig):
8-
return pytestconfig.rootdir / "tests"
10+
def test_dir(pytestconfig: _pytest.config.Config) -> pathlib.Path:
11+
return pytestconfig.rootdir / "tests" # type: ignore
912

1013

1114
@pytest.fixture(autouse=True)
12-
def mock_clean_config(monkeypatch):
15+
def mock_clean_config(monkeypatch: pytest.MonkeyPatch) -> None:
1316
"""Ensures user-defined environment variables do not interfere with tests."""
1417
monkeypatch.delenv("PYTHON_GITLAB_CFG", raising=False)
1518
monkeypatch.delenv("GITLAB_PRIVATE_TOKEN", raising=False)
@@ -19,19 +22,19 @@ def mock_clean_config(monkeypatch):
1922

2023

2124
@pytest.fixture(autouse=True)
22-
def default_files(monkeypatch):
25+
def default_files(monkeypatch: pytest.MonkeyPatch) -> None:
2326
"""Ensures user configuration files do not interfere with tests."""
2427
monkeypatch.setattr(gitlab.config, "_DEFAULT_FILES", [])
2528

2629

2730
@pytest.fixture
28-
def valid_gitlab_ci_yml():
31+
def valid_gitlab_ci_yml() -> str:
2932
return """---
3033
:test_job:
3134
:script: echo 1
3235
"""
3336

3437

3538
@pytest.fixture
36-
def invalid_gitlab_ci_yml():
39+
def invalid_gitlab_ci_yml() -> str:
3740
return "invalid"

0 commit comments

Comments
 (0)