Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
villebro committed Jul 2, 2024
1 parent 7ba66f8 commit 481bc7b
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tests/integration_tests/extensions/metastore_cache_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,21 @@

from contextlib import nullcontext
from datetime import datetime, timedelta
from typing import Any, TYPE_CHECKING
from typing import Any
from uuid import UUID

import pytest
from flask.ctx import AppContext
from freezegun import freeze_time

from superset.extensions.metastore_cache import SupersetMetastoreCache
from superset.key_value.exceptions import KeyValueCodecEncodeException
from superset.key_value.types import (
JsonKeyValueCodec,
KeyValueCodec,
PickleKeyValueCodec,
)

if TYPE_CHECKING:
from superset.extensions.metastore_cache import SupersetMetastoreCache

NAMESPACE = UUID("ee173d1b-ccf3-40aa-941c-985c15224496")

FIRST_KEY = "foo"
Expand All @@ -47,19 +45,13 @@

@pytest.fixture
def cache() -> SupersetMetastoreCache:
from superset.extensions.metastore_cache import SupersetMetastoreCache

return SupersetMetastoreCache(
namespace=NAMESPACE,
default_timeout=600,
codec=PickleKeyValueCodec(),
)


def test_instantiation(cache: SupersetMetastoreCache) -> None:
assert cache


def test_caching_flow(app_context: AppContext, cache: SupersetMetastoreCache) -> None:
assert cache.has(FIRST_KEY) is False
assert cache.add(FIRST_KEY, FIRST_KEY_INITIAL_VALUE) is True
Expand Down

0 comments on commit 481bc7b

Please sign in to comment.