Skip to content

Commit

Permalink
Clean up after tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albertyw committed Jan 16, 2024
1 parent 6779e48 commit dde3098
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions project/tests/test_execute_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ def setUpClass(cls):
super().setUpClass()
call_execute_sql(cls, None)

def tearDown(self):
DataCollector().stop_python_profiler()

def test_called(self):
self.mock_sql._execute_sql.assert_called_once_with(*self.args, **self.kwargs)

Expand All @@ -65,6 +68,9 @@ def setUpClass(cls):
super().setUpClass()
call_execute_sql(cls, Request())

def tearDown(self):
DataCollector().stop_python_profiler()

def test_called(self):
self.mock_sql._execute_sql.assert_called_once_with(*self.args, **self.kwargs)

Expand All @@ -77,6 +83,9 @@ def test_query(self):


class TestCallSilky(TestCase):
def tearDown(self):
DataCollector().stop_python_profiler()

def test_no_effect(self):
DataCollector().configure()
sql, _ = mock_sql()
Expand All @@ -89,6 +98,9 @@ def test_no_effect(self):


class TestCollectorInteraction(TestCase):
def tearDown(self):
DataCollector().stop_python_profiler()

def _query(self):
try:
query = list(DataCollector().queries.values())[0]
Expand Down

0 comments on commit dde3098

Please sign in to comment.