Skip to content

Commit

Permalink
prevent getting this helper method collected as a test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Apr 26, 2019
1 parent 7df6e0d commit 08fdcad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def models(self):
return "test/integration/007_graph_selection_tests/models"

def assert_correct_schemas(self):
with self.test_connection():
with self.get_connection():
exists = self.adapter.check_schema_exists(
self.default_database,
self.unique_schema()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def tearDown(self):
# This has to happen before we drop the external schema, because
# otherwise postgres hangs forever.
self._drop_schemas()
with self.test_connection():
with self.get_connection():
self.adapter.drop_schema(self.default_database, self.external_schema)
super(TestExternalReference, self).tearDown()

Expand All @@ -55,7 +55,7 @@ def tearDown(self):
# This has to happen before we drop the external schema, because
# otherwise postgres hangs forever.
self._drop_schemas()
with self.test_connection():
with self.get_connection():
self.adapter.drop_schema(self.default_database, self.external_schema)
super(TestExternalDependency, self).tearDown()

Expand Down
8 changes: 4 additions & 4 deletions test/integration/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def run_sql(self, query, fetch='None', kwargs=None, connection_name=None):

sql = self.transform_sql(query, kwargs=kwargs)

with self.test_connection(connection_name) as conn:
with self.get_connection(connection_name) as conn:
logger.debug('test connection "{}" executing: {}'.format(conn.name, sql))
if self.adapter_type == 'bigquery':
return self.run_sql_bigquery(sql, fetch)
Expand Down Expand Up @@ -631,7 +631,7 @@ def filter_many_columns(self, column):
return (table_name, column_name, data_type, char_size)

@contextmanager
def test_connection(self, name=None):
def get_connection(self, name=None):
"""Create a test connection context where all executed macros, etc will
get self.adapter as the adapter.
Expand All @@ -645,7 +645,7 @@ def test_connection(self, name=None):
yield conn

def get_relation_columns(self, relation):
with self.test_connection():
with self.get_connection():
columns = self.adapter.get_columns_in_relation(relation)

return sorted(((c.name, c.dtype, c.char_size) for c in columns),
Expand Down Expand Up @@ -811,7 +811,7 @@ def assertManyRelationsEqual(self, relations, default_schema=None, default_datab

specs.append(relation)

with self.test_connection():
with self.get_connection():
column_specs = self.get_many_relation_columns(specs)

# make sure everyone has equal column definitions
Expand Down

0 comments on commit 08fdcad

Please sign in to comment.