Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Commit 1452856

Browse files
committed
TestSeriesStringMethods and TestStringMethods inherit from TestBase.
1 parent 2ad7237 commit 1452856

3 files changed

Lines changed: 20 additions & 21 deletions

File tree

sdc/tests/tests_perf/test_perf_base.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,26 @@
66

77
class TestBase(unittest.TestCase):
88
iter_number = 5
9+
test_results_class = TestResults
910

1011
@classmethod
11-
def setUpClass(cls):
12+
def create_test_results(cls):
1213
drivers = []
1314
if is_true(os.environ.get('SDC_TEST_PERF_EXCEL', True)):
1415
drivers.append(ExcelResultsDriver('perf_results.xlsx'))
1516
if is_true(os.environ.get('SDC_TEST_PERF_CSV', False)):
1617
drivers.append(CSVResultsDriver('perf_results.csv'))
1718

18-
cls.test_results = TestResults(drivers)
19+
results = cls.test_results_class(drivers)
1920

2021
if is_true(os.environ.get('LOAD_PREV_RESULTS')):
21-
cls.test_results.load()
22+
results.load()
23+
24+
return results
25+
26+
@classmethod
27+
def setUpClass(cls):
28+
cls.test_results = cls.create_test_results()
2229

2330
cls.total_data_length = []
2431
cls.num_threads = int(os.environ.get('NUMBA_NUM_THREADS', config.NUMBA_NUM_THREADS))

sdc/tests/tests_perf/test_perf_series_str.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import pandas as pd
3535

3636
from sdc.tests.test_utils import *
37+
from sdc.tests.tests_perf.test_perf_base import TestBase
3738
from sdc.tests.tests_perf.test_perf_utils import *
3839

3940

@@ -109,25 +110,19 @@ def usecase_series_strip(input_data):
109110
return finish_time - start_time, res
110111

111112

112-
class TestSeriesStringMethods(unittest.TestCase):
113+
class TestSeriesStringMethods(TestBase):
113114
iter_number = 5
115+
test_results_class = TestResultsStr
114116

115117
@classmethod
116118
def setUpClass(cls):
117-
cls.test_results = TestResultsStr()
118-
if is_true(os.environ.get('LOAD_PREV_RESULTS')):
119-
cls.test_results.load()
119+
super().setUpClass()
120120

121121
cls.total_data_length = [10**4, 10**5]
122122
cls.width = [16, 64, 512, 1024]
123123
cls.num_threads = int(os.environ.get('NUMBA_NUM_THREADS', config.NUMBA_NUM_THREADS))
124124
cls.threading_layer = os.environ.get('NUMBA_THREADING_LAYER', config.THREADING_LAYER)
125125

126-
@classmethod
127-
def tearDownClass(cls):
128-
cls.test_results.print()
129-
cls.test_results.dump()
130-
131126
def _test_series_str(self, pyfunc, name, input_data=None):
132127
input_data = input_data or test_global_input_data_unicode_kind4
133128
hpat_func = sdc.jit(pyfunc)

sdc/tests/tests_perf/test_perf_unicode.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import numba
3232

3333
from sdc.tests.test_utils import *
34+
from sdc.tests.tests_perf.test_perf_base import TestBase
3435
from sdc.tests.tests_perf.test_perf_utils import *
3536

3637

@@ -92,20 +93,16 @@ def usecase_center(input_data):
9293
return iter_time
9394

9495

95-
class TestStringMethods(unittest.TestCase):
96+
class TestStringMethods(TestBase):
97+
test_results_class = TestResultsStr
98+
9699
@classmethod
97100
def setUpClass(cls):
98-
cls.test_results = TestResultsStr()
99-
if is_true(os.environ.get('LOAD_PREV_RESULTS')):
100-
cls.test_results.load()
101+
super().setUpClass()
101102

102-
cls.total_data_size_bytes = [1.0E+07]
103+
cls.total_data_size_bytes = [1.0E+04]
103104
cls.width = [16, 64, 512, 1024]
104105

105-
@classmethod
106-
def tearDownClass(cls):
107-
cls.test_results.print()
108-
109106
def _test_unicode(self, pyfunc, name):
110107
hpat_func = numba.njit(pyfunc)
111108
for data_size in self.total_data_size_bytes:

0 commit comments

Comments
 (0)