Skip to content

Commit

Permalink
use of py.raises
Browse files Browse the repository at this point in the history
  • Loading branch information
siddiquebagwan-gslab committed Sep 26, 2023
1 parent 9321e3d commit b104d79
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions metadata-ingestion/tests/integration/powerbi/test_powerbi.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import re
import sys
from typing import Any, Dict, List, cast
from unittest import mock
Expand Down Expand Up @@ -1126,7 +1127,7 @@ def test_dataset_type_mapping_error(
"""
register_mock_api(request_mock=requests_mock)

try:
with pytest.raises(Exception, match=r"dataset_type_mapping is deprecated"):
Pipeline.create(
{
"run_id": "powerbi-test",
Expand All @@ -1149,11 +1150,6 @@ def test_dataset_type_mapping_error(
},
}
)
except Exception as e:
assert (
"dataset_type_mapping is deprecated. Use server_to_platform_instance only."
in str(e)
)


@freeze_time(FROZEN_TIME)
Expand Down Expand Up @@ -1568,7 +1564,12 @@ def test_cll_extraction_flags(
)

default_conf: dict = default_source_config()
try:
pattern: str = re.escape(
"Enable all these flags in recipe: ['native_query_parsing', 'enable_advance_lineage_sql_construct', 'extract_lineage']"
)

with pytest.raises(Exception, match=pattern):

Pipeline.create(
{
"run_id": "powerbi-test",
Expand All @@ -1587,8 +1588,3 @@ def test_cll_extraction_flags(
},
}
)
except Exception as e:
assert (
"Enable all these flags in recipe: ['native_query_parsing', 'enable_advance_lineage_sql_construct', 'extract_lineage']"
in str(e)
)

0 comments on commit b104d79

Please sign in to comment.