From 619987b520e7be75a0e3956cbfae9c279af206e8 Mon Sep 17 00:00:00 2001 From: Yannik Tausch Date: Sat, 29 Jun 2024 16:50:56 +0200 Subject: [PATCH] add tests for is_solvability_check needed (1/2) --- tests/fake_lazy_json.py | 15 +++++++++++++++ tests/test_auto_tick.py | 8 ++++---- 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 tests/fake_lazy_json.py diff --git a/tests/fake_lazy_json.py b/tests/fake_lazy_json.py new file mode 100644 index 0000000000..2880d85226 --- /dev/null +++ b/tests/fake_lazy_json.py @@ -0,0 +1,15 @@ +from types import TracebackType +from typing import Self + + +class FakeLazyJson(dict): + def __enter__(self) -> Self: + return self + + def __exit__( + self, + exc_type: type[BaseException] | None, + exc_val: BaseException | None, + exc_tb: TracebackType | None, + ) -> None: + pass diff --git a/tests/test_auto_tick.py b/tests/test_auto_tick.py index 56235a3fd4..c6b85c7456 100644 --- a/tests/test_auto_tick.py +++ b/tests/test_auto_tick.py @@ -15,11 +15,11 @@ GitPlatformBackend, RepositoryNotFoundError, ) -from conda_forge_tick.lazy_json_backends import LazyJson from conda_forge_tick.migrators_types import AttrsTypedDict +from tests.fake_lazy_json import FakeLazyJson demo_attrs = AttrsTypedDict( - {"conda-forge.yml": {"provider": {"default_branch": "main"}}} + {"conda-forge.yml": {"provider": {"default_branch": "main"}, "bot": {}}} ) @@ -63,8 +63,8 @@ def test_prepare_feedstock_repository_repository_not_found(caplog): demo_attrs_copy = copy.deepcopy(demo_attrs) - attrs = LazyJson(str(tmpdir / "test-attrs-1337.json")) - pr_info = LazyJson(str(tmpdir / "test-pr-info-1337.json")) + attrs = FakeLazyJson() + pr_info = FakeLazyJson() with attrs: for key, value in demo_attrs_copy.items():