Skip to content

Commit

Permalink
warn on unspecified test name
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Sep 14, 2018
1 parent b4772bc commit 6652ece
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions test/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
from dbt.config import RuntimeConfig

from dbt.logger import GLOBAL_LOGGER as logger
import logging
import warnings


DBT_CONFIG_DIR = os.path.abspath(
Expand All @@ -40,19 +42,19 @@ def __init__(self, kwargs):


def _profile_from_test_name(test_name):
adapters_in_name = sum(x in test_name for x in
('postgres', 'snowflake', 'redshift', 'bigquery'))
adapter_names = ('postgres', 'snowflake', 'redshift', 'bigquery')
adapters_in_name = sum(x in test_name for x in adapter_names)
if adapters_in_name > 1:
raise ValueError('test names must only have 1 profile choice embedded')

if 'snowflake' in test_name:
return 'snowflake'
elif 'redshift' in test_name:
return 'redshift'
elif 'bigquery' in test_name:
return 'bigquery'
else:
return 'postgres'
for adapter_name in adapter_names:
if adapter_name in test_name:
return adapter_name

warnings.warn(
'could not find adapter name in test name {}'.format(test_name)
)
return 'postgres'


class DBTIntegrationTest(unittest.TestCase):
Expand Down Expand Up @@ -201,6 +203,8 @@ def _pick_profile(self):

def setUp(self):
flags.reset()
# disable capturing warnings
logging.captureWarnings(False)
self._clean_files()

self.use_profile(self._pick_profile())
Expand Down

0 comments on commit 6652ece

Please sign in to comment.