Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pytest #527

Merged
merged 5 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 33 additions & 34 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ networkx = "^3.1"
kubernetes-asyncio = "^29.0.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.1.2"
pytest-mock = "^3.10.0"
pytest-timeout = "^2.1.0"
pytest = "^8.3.2"
pytest-mock = "^3.14.0"
pytest-timeout = "^2.3.1"
pytest-snapshot = "^0.9.0"
pytest-rerunfailures = "^14.0"
pytest-asyncio = "^0.23.8"
pytest-httpx = "^0.30.0"
pre-commit = "^2.19.0"
ruff = "^0.5.5"
typer-cli = "^0.0.13"
pyright = "^1.1.352"
pytest-rerunfailures = "^11.1.2"
pytest-asyncio = "^0.21.1"
pytest-httpx = "^0.30.0"
pytablewriter = { extras = ["from"], version = "^1.0.0" }
polyfactory = "^2.13.0"

Expand Down
7 changes: 7 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import pytest

from kpops.config import KpopsConfig
from kpops.utils.environment import ENV, Environment
from kpops.utils.yaml import load_yaml_file

Expand Down Expand Up @@ -51,3 +52,9 @@ def custom_components():
yield
finally:
shutil.rmtree(dst)


@pytest.fixture(scope="module")
def clear_kpops_config():
yield
KpopsConfig._instance = None
2 changes: 1 addition & 1 deletion tests/pipeline/test_clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
RESOURCE_PATH = Path(__file__).parent / "resources"


@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache")
@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache", "clear_kpops_config")
class TestClean:
@pytest.fixture(autouse=True)
def helm_mock(self, mocker: MockerFixture) -> MagicMock:
Expand Down
2 changes: 1 addition & 1 deletion tests/pipeline/test_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RESOURCE_PATH = Path(__file__).parent / "resources"


@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache")
@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache", "clear_kpops_config")
class TestDeploy:
@pytest.fixture(autouse=True)
def mock_helm(self, mocker: MockerFixture) -> MagicMock:
Expand Down
2 changes: 1 addition & 1 deletion tests/pipeline/test_destroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RESOURCE_PATH = Path(__file__).parent / "resources"


@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache")
@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache", "clear_kpops_config")
class TestDestroy:
@pytest.fixture(autouse=True)
def mock_helm(self, mocker: MockerFixture) -> MagicMock:
Expand Down
2 changes: 1 addition & 1 deletion tests/pipeline/test_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
EXAMPLES_PATH = Path("examples").absolute()


@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache")
@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache", "clear_kpops_config")
class TestExample:
@pytest.fixture(scope="class", autouse=True)
def cd(self):
Expand Down
4 changes: 3 additions & 1 deletion tests/pipeline/test_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
RESOURCE_PATH = Path(__file__).parent / "resources"


@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache", "custom_components")
@pytest.mark.usefixtures(
"mock_env", "load_yaml_file_clear_cache", "custom_components", "clear_kpops_config"
)
class TestGenerate:
@pytest.fixture(autouse=True)
def log_info(self, mocker: MockerFixture) -> MagicMock:
Expand Down
2 changes: 1 addition & 1 deletion tests/pipeline/test_reset.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
RESOURCE_PATH = Path(__file__).parent / "resources"


@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache")
@pytest.mark.usefixtures("mock_env", "load_yaml_file_clear_cache", "clear_kpops_config")
class TestReset:
@pytest.fixture(autouse=True)
def helm_mock(self, mocker: MockerFixture) -> MagicMock:
Expand Down
5 changes: 4 additions & 1 deletion tests/test_kpops_config.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import re
from pathlib import Path

import pytest
Expand Down Expand Up @@ -71,7 +72,9 @@ def test_kpops_config_with_different_invalid_urls():
def test_global_kpops_config_not_initialized_error():
with pytest.raises(
RuntimeError,
match=r"KpopsConfig has not been initialized, call KpopsConfig.create\(\) first.",
match=re.escape(
"KpopsConfig has not been initialized, call KpopsConfig.create() first."
),
):
get_config()

Expand Down
Loading