Skip to content

Commit

Permalink
Add a convenience use_on() on TestPersistence
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Mar 20, 2023
1 parent 5ace1e6 commit 3495e99
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
3 changes: 1 addition & 2 deletions rebench/tests/executor_test.py
Expand Up @@ -74,8 +74,7 @@ def _basic_execution(self, cnf):

runs = cnf.get_runs()
persistence = TestPersistence()
for run in runs:
run.add_persistence(persistence)
persistence.use_on(runs)

ex = Executor(runs, cnf.do_builds, self.ui)
ex.execute()
Expand Down
4 changes: 2 additions & 2 deletions rebench/tests/features/issue_16_multiple_data_points_test.py
Expand Up @@ -41,8 +41,8 @@ def _records_data_points(self, exp_name, num_data_points):
data_file=self._tmp_file)
runs = cnf.get_runs()
persistence = TestPersistence()
for run in runs:
run.add_persistence(persistence)
persistence.use_on(runs)

ex = Executor(cnf.get_runs(), False, self.ui)
ex.execute()
self.assertEqual(1, len(cnf.get_runs()))
Expand Down
Expand Up @@ -41,8 +41,7 @@ def _records_data_points(self, exp_name, num_data_points):
data_file=self._tmp_file)
runs = cnf.get_runs()
persistence = TestPersistence()
for run in runs:
run.add_persistence(persistence)
persistence.use_on(runs)

ex = Executor(runs, False, self.ui)
ex.execute()
Expand Down
4 changes: 4 additions & 0 deletions rebench/tests/persistence.py
Expand Up @@ -4,6 +4,10 @@ class TestPersistence(object):
def __init__(self):
self._data_points = []

def use_on(self, runs):
for run in runs:
run.add_persistence(self)

def get_data_points(self, run_id=None):
if run_id:
return [dp for dp in self._data_points if dp.run_id is run_id]
Expand Down

0 comments on commit 3495e99

Please sign in to comment.