chore(python-testing): move memoized tests to unit tests (#15507)

* chore: move memoized test into a separated file

create integration test workflow

* chore: create unit test workflow to run purely pytest

* fix: bad reference

* fix: remove pip requirements bc there aren't any yet

* temp: install unit dependencies directly

* fix: --rootdir=

* fix: try to run only unit test

* chore: decouple memoized as separated module

* fix: bring back dependencies bc superset top-level module is coupled to flask and others so no reason no to do it

* fix: reference

* fix: pre-commit

* fix: pylint
This commit is contained in:
Amit Miran
2021-07-12 10:00:18 +03:00
committed by GitHub
parent 9ed8ce53ed
commit 62a8f2e193
14 changed files with 391 additions and 296 deletions

View File

@@ -35,6 +35,7 @@ from superset.models.tags import ChartUpdater
from superset.tasks.thumbnails import cache_chart_thumbnail
from superset.utils import core as utils
from superset.utils.hashing import md5_sha_from_str
from superset.utils.memoized import memoized
from superset.utils.urls import get_url_path
from superset.viz import BaseViz, viz_types # type: ignore
@@ -117,7 +118,7 @@ class Slice(
# pylint: disable=using-constant-test
@datasource.getter # type: ignore
@utils.memoized
@memoized
def get_datasource(self) -> Optional["BaseDatasource"]:
return db.session.query(self.cls_model).filter_by(id=self.datasource_id).first()
@@ -156,7 +157,7 @@ class Slice(
# pylint: enable=using-constant-test
@property # type: ignore
@utils.memoized
@memoized
def viz(self) -> Optional[BaseViz]:
form_data = json.loads(self.params)
viz_class = viz_types.get(self.viz_type)