Skip to content

Commit

Permalink
use block-style comments per PR feedback
Browse files Browse the repository at this point in the history
Fix the tests
  • Loading branch information
Jacob Beck committed Oct 30, 2019
1 parent 38788aa commit 3c377b3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
8 changes: 1 addition & 7 deletions core/dbt/adapters/base/query_headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,7 @@ def __init__(self, initial):
self.query_comment: str = initial

def add(self, sql: str) -> str:
# Make sure there are no trailing newlines.
# For every newline, add a comment after it in case query_comment
# is multiple lines.
# Then add a comment to the first line of the query comment, and
# put the sql on a fresh line.
comment_split = self.query_comment.strip().replace('\n', '\n-- ')
return '-- {}\n{}'.format(comment_split, sql)
return '/* {} */\n{}'.format(self.query_comment.strip(), sql)

def set(self, comment: str):
self.query_comment = comment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def project_config(self):

def matches_comment(self, msg) -> bool:
self.assertTrue(
msg.startswith('-- dbt\n-- rules!\n'),
msg.startswith('/* dbt\nrules! */\n'),
f'{msg} did not start with query comment'
)

Expand All @@ -102,10 +102,10 @@ def test_bigquery_comments(self):

class TestDefaultQueryComments(QueryComments):
def matches_comment(self, msg):
if not msg.startswith('-- '):
if not msg.startswith('/* '):
return False
# our blob is the first line of the query comments, minus the '-- '
json_str = msg.split('\n')[0][3:]
# our blob is the first line of the query comments, minus the comment
json_str = msg.split('\n')[0][3:-3]
data = json.loads(json_str)
self.assertEqual(data['app'], 'dbt')
self.assertEqual(data['dbt_version'], dbt_version)
Expand Down
6 changes: 0 additions & 6 deletions test/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,9 @@ def setUp(self):
os.chdir(self.initial_dir)
# before we go anywhere, collect the initial path info
self._logs_dir = os.path.join(self.initial_dir, 'logs', self.prefix)
print('initial_dir={}'.format(self.initial_dir))
_really_makedirs(self._logs_dir)
self.test_original_source_path = _pytest_get_test_root()
print('test_original_source_path={}'.format(self.test_original_source_path))
self.test_root_dir = normalize(tempfile.mkdtemp(prefix='dbt-int-test-'))
print('test_root_dir={}'.format(self.test_root_dir))
os.chdir(self.test_root_dir)
try:
self._symlink_test_folders()
Expand Down Expand Up @@ -397,9 +394,6 @@ def set_packages(self):
with open('packages.yml', 'w') as f:
yaml.safe_dump(self.packages_config, f, default_flow_style=True)

def test_only_config(self):
return None

def load_config(self):
# we've written our profile and project. Now we want to instantiate a
# fresh adapter for the tests.
Expand Down

0 comments on commit 3c377b3

Please sign in to comment.