Skip to content

Commit 49364c9

Browse files
committed
num_times_created_this_run -> _num_times_created_this_run
1 parent b5fd76e commit 49364c9

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

benchmark/tests/integtest_benchmark.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def setUp(self) -> None:
3232
shutil.rmtree(workspace_path)
3333

3434
# Reset this to avoid the error of it being created twice.
35-
# In real usage, the second run would be a different Python process so DBGymWorkspace.num_times_created_this_run would be 0.
36-
DBGymWorkspace.num_times_created_this_run = 0
35+
# In real usage, the second run would be a different Python process so DBGymWorkspace._num_times_created_this_run would be 0.
36+
DBGymWorkspace._num_times_created_this_run = 0
3737
self.workspace = DBGymWorkspace(workspace_path)
3838

3939
def tearDown(self) -> None:

dbms/tests/integtest_dbms.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def setUp(self) -> None:
2424
shutil.rmtree(workspace_path)
2525

2626
# Reset this to avoid the error of it being created twice.
27-
# In real usage, the second run would be a different Python process so DBGymWorkspace.num_times_created_this_run would be 0.
28-
DBGymWorkspace.num_times_created_this_run = 0
27+
# In real usage, the second run would be a different Python process so DBGymWorkspace._num_times_created_this_run would be 0.
28+
DBGymWorkspace._num_times_created_this_run = 0
2929
self.workspace = DBGymWorkspace(workspace_path)
3030

3131
def tearDown(self) -> None:
@@ -44,10 +44,10 @@ def test_postgres_dbdata(self) -> None:
4444
# Make sure to recreate self.workspace so that each function call counts as its own run.
4545
scale_factor = 0.01
4646
_postgres_build(self.workspace, False)
47-
DBGymWorkspace.num_times_created_this_run = 0
47+
DBGymWorkspace._num_times_created_this_run = 0
4848
self.workspace = DBGymWorkspace(self.workspace.dbgym_workspace_path)
4949
_tpch_tables(self.workspace, scale_factor)
50-
DBGymWorkspace.num_times_created_this_run = 0
50+
DBGymWorkspace._num_times_created_this_run = 0
5151
self.workspace = DBGymWorkspace(self.workspace.dbgym_workspace_path)
5252

5353
# Test

env/tests/gymlib_integtest_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def set_up_workspace() -> None:
7070
# However, it also can't be created more than once so we need to check `is None`.
7171
if GymlibIntegtestManager.DBGYM_WORKSPACE is None:
7272
# Reset this in case it had been created by a test *not* using GymlibIntegtestManager.set_up_workspace().
73-
DBGymWorkspace.num_times_created_this_run = 0
73+
DBGymWorkspace._num_times_created_this_run = 0
7474
GymlibIntegtestManager.DBGYM_WORKSPACE = DBGymWorkspace(workspace_path)
7575

7676
@staticmethod

util/tests/unittest_workspace.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def tearDown(self) -> None:
4040
# Importantly though, I don't have helper functions for the complex functions that I want to test (e.g. link_result and save_file).
4141
def init_workspace_helper(self) -> None:
4242
# Reset this to avoid the error of it being created twice.
43-
# In real usage, the second run would be a different Python process so DBGymWorkspace.num_times_created_this_run would be 0.
44-
DBGymWorkspace.num_times_created_this_run = 0
43+
# In real usage, the second run would be a different Python process so DBGymWorkspace._num_times_created_this_run would be 0.
44+
DBGymWorkspace._num_times_created_this_run = 0
4545
self.workspace = DBGymWorkspace(self.workspace_path)
4646

4747
if self.expected_structure is None:

util/workspace.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ class DBGymWorkspace:
9696
Global configurations that apply to all parts of DB-Gym
9797
"""
9898

99-
num_times_created_this_run: int = 0
99+
_num_times_created_this_run: int = 0
100100

101101
def __init__(self, dbgym_workspace_path: Path):
102102
# The logic around dbgym_tmp_path assumes that DBGymWorkspace is only constructed once.
103103
# This is because DBGymWorkspace creates a new run_*/ dir when it's initialized.
104-
DBGymWorkspace.num_times_created_this_run += 1
104+
DBGymWorkspace._num_times_created_this_run += 1
105105
assert (
106-
DBGymWorkspace.num_times_created_this_run == 1
107-
), f"DBGymWorkspace has been created {DBGymWorkspace.num_times_created_this_run} times. It should only be created once per run."
106+
DBGymWorkspace._num_times_created_this_run == 1
107+
), f"DBGymWorkspace has been created {DBGymWorkspace._num_times_created_this_run} times. It should only be created once per run."
108108

109109
self.base_dbgym_repo_path = get_base_dbgym_repo_path()
110110
self.cur_path_list: list[str] = ["dbgym"]

0 commit comments

Comments
 (0)