Skip to content

Commit

Permalink
Attempt to fix metrica tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vallbull committed Nov 28, 2023
1 parent 0dbbd09 commit bcd843b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
Tuple,
)

from dl_constants.enums import UserDataType
from dl_constants.enums import (
DataSourceType,
UserDataType,
)
from dl_core import exc
from dl_core.data_source.sql import PseudoSQLDataSource
from dl_core.db import (
Expand All @@ -22,6 +25,8 @@
from dl_connector_metrica.core.constants import (
CONNECTION_TYPE_APPMETRICA_API,
CONNECTION_TYPE_METRICA_API,
SOURCE_TYPE_APPMETRICA_API,
SOURCE_TYPE_METRICA_API,
)
from dl_connector_metrica.core.us_connection import MetrikaApiConnection

Expand Down Expand Up @@ -88,6 +93,14 @@ def get_expression_value_range(self, col_name: str) -> Tuple[Any, Any]:

return min_value, max_value

@classmethod
def is_compatible_with_type(cls, source_type: DataSourceType) -> bool:
return source_type == SOURCE_TYPE_METRICA_API


class AppMetrikaApiDataSource(MetrikaApiDataSource):
conn_type = CONNECTION_TYPE_APPMETRICA_API

@classmethod
def is_compatible_with_type(cls, source_type: DataSourceType) -> bool:
return source_type == SOURCE_TYPE_APPMETRICA_API
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
from typing import Optional
from typing import (
AbstractSet,
Optional,
)

import pytest
import sqlalchemy as sa

from dl_constants.enums import (
DataSourceRole,
JoinType,
UserDataType,
)
from dl_core.dataset_capabilities import DatasetCapabilities
Expand Down Expand Up @@ -232,6 +236,12 @@ def test_source_cannot_be_added(
finally:
sync_us_manager.delete(testing_conn)

def _check_supported_join_types(self, supp_join_types: AbstractSet[JoinType]) -> None:
assert not supp_join_types

def _allow_adding_sources(self, dataset: Dataset) -> bool:
return False


class TestAppMetricaDataset(BaseAppMetricaTestClass, DefaultDatasetTestSuite[AppMetricaApiConnection]):
source_type = SOURCE_TYPE_APPMETRICA_API
Expand All @@ -245,6 +255,12 @@ class TestAppMetricaDataset(BaseAppMetricaTestClass, DefaultDatasetTestSuite[App
},
)

def _check_supported_join_types(self, supp_join_types: AbstractSet[JoinType]) -> None:
assert not supp_join_types

def _allow_adding_sources(self, dataset: Dataset) -> bool:
return False

@pytest.fixture(scope="function")
def dsrc_params(self) -> dict:
return dict(
Expand Down

0 comments on commit bcd843b

Please sign in to comment.