Skip to content

Commit

Permalink
chore(tests): migrate mssql tests to pytest (#18251)
Browse files Browse the repository at this point in the history
* move test

* migrate to pytest
  • Loading branch information
villebro committed Feb 2, 2022
1 parent 8c37654 commit 7ad38d5
Show file tree
Hide file tree
Showing 3 changed files with 344 additions and 316 deletions.
310 changes: 0 additions & 310 deletions tests/integration_tests/db_engine_specs/mssql_tests.py

This file was deleted.

10 changes: 4 additions & 6 deletions tests/unit_tests/db_engine_specs/test_kusto.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import pytest
from flask.ctx import AppContext

from tests.unit_tests.fixtures.common import dttm


@pytest.mark.parametrize(
"sql,expected",
Expand Down Expand Up @@ -119,16 +121,14 @@ def test_kql_parse_sql(app_context: AppContext) -> None:
],
)
def test_kql_convert_dttm(
app_context: AppContext, target_type: str, expected_dttm: str
app_context: AppContext, target_type: str, expected_dttm: str, dttm: datetime,
) -> None:
"""
Test that date objects are converted correctly.
"""

from superset.db_engine_specs.kusto import KustoKqlEngineSpec

dttm = datetime.strptime("2019-01-02 03:04:05.678900", "%Y-%m-%d %H:%M:%S.%f")
print(dttm)
assert expected_dttm == KustoKqlEngineSpec.convert_dttm(target_type, dttm)


Expand All @@ -142,14 +142,12 @@ def test_kql_convert_dttm(
],
)
def test_sql_convert_dttm(
app_context: AppContext, target_type: str, expected_dttm: str
app_context: AppContext, target_type: str, expected_dttm: str, dttm: datetime,
) -> None:
"""
Test that date objects are converted correctly.
"""

from superset.db_engine_specs.kusto import KustoSqlEngineSpec

dttm = datetime.strptime("2019-01-02 03:04:05.678900", "%Y-%m-%d %H:%M:%S.%f")
print(dttm)
assert expected_dttm == KustoSqlEngineSpec.convert_dttm(target_type, dttm)
Loading

0 comments on commit 7ad38d5

Please sign in to comment.