Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 155aa13

Browse filesBrowse files
committed
adding comments
1 parent 974f690 commit 155aa13
Copy full SHA for 155aa13

File tree

Expand file treeCollapse file tree

1 file changed

+11
-12
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-12
lines changed

‎tests/performance/django_spanner/test_benchmark.py

Copy file name to clipboardExpand all lines: tests/performance/django_spanner/test_benchmark.py
+11-12Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def insert_many_rows(transaction, many_rows):
6464

6565

6666
class DjangoBenchmarkTest():
67+
"""The Django performace testing class."""
6768
def __init__(self):
6869
with connection.schema_editor() as editor:
6970
# Create the tables
@@ -77,13 +78,6 @@ def __init__(self):
7778
num2 = round(random.randint(0,100000000))
7879
self._many_rows2.append(Author(num2, "Pete", "Allison", "2.1"))
7980

80-
def _cleanup(self):
81-
"""Drop the test table."""
82-
with connection.schema_editor() as editor:
83-
# delete the table
84-
editor.delete_model(Author)
85-
# teardown_instance()
86-
8781
@measure_execution_time
8882
def insert_one_row_with_fetch_after(self):
8983
author_kent = Author(
@@ -118,6 +112,12 @@ def select_many_rows(self):
118112
if len(rows) != 100:
119113
raise ValueError("Wrong number of rows read")
120114

115+
def _cleanup(self):
116+
"""Drop the test table."""
117+
with connection.schema_editor() as editor:
118+
# delete the table
119+
editor.delete_model(Author)
120+
121121
def run(self):
122122
"""Execute every test case."""
123123
measures = {}
@@ -130,13 +130,11 @@ def run(self):
130130
):
131131
method(measures)
132132
self._cleanup()
133-
# import pdb
134-
# pdb.set_trace()
135133
return measures
136134

137135

138136
class SpannerBenchmarkTest():
139-
"""The original Spanner performace testing class."""
137+
"""The Spanner performace testing class."""
140138
def __init__(self):
141139
self._create_table()
142140
self._one_row = (
@@ -236,10 +234,11 @@ def run(self):
236234

237235
@pytest.mark.django_db()
238236
class BenchmarkTest(unittest.TestCase):
239-
240-
def test_run(self):
237+
def setUp(self):
241238
setup_instance()
242239
setup_database()
240+
241+
def test_run(self):
243242
django_obj = pd.DataFrame(columns = ['insert_one_row_with_fetch_after', 'read_one_row', 'insert_many_rows', 'select_many_rows',
244243
'insert_many_rows_with_mutations'])
245244
spanner_obj = pd.DataFrame(columns = ['insert_one_row_with_fetch_after', 'read_one_row', 'insert_many_rows', 'select_many_rows',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.