Skip to content

Commit b728958

Browse files
committed
set_up_integtest_workspace helper
1 parent fe8424e commit b728958

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

env/integtest_pg_conn.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
ENV_INTEGTESTS_DBGYM_CONFIG_FPATH,
77
INTEGTEST_DBGYM_CFG,
88
get_integtest_workspace_path,
9+
set_up_integtest_workspace,
910
)
1011
from env.pg_conn import PostgresConn
1112
from util.pg import (
@@ -30,9 +31,7 @@ class PostgresConnTests(unittest.TestCase):
3031

3132
@staticmethod
3233
def setUpClass() -> None:
33-
# If you're running the test locally, this check makes runs past the first one much faster.
34-
if not get_integtest_workspace_path().exists():
35-
subprocess.run(["./env/set_up_env_integtests.sh"], check=True)
34+
set_up_integtest_workspace()
3635

3736
def setUp(self) -> None:
3837
self.assertFalse(

env/integtest_tuning_agent.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import unittest
33
from typing import Any, Optional
44

5-
from env.integtest_util import INTEGTEST_DBGYM_CFG, get_integtest_workspace_path
5+
from env.integtest_util import INTEGTEST_DBGYM_CFG, get_integtest_workspace_path, set_up_integtest_workspace
66
from env.tuning_agent import DBMSConfigDelta, TuningAgent
77

88

@@ -22,9 +22,7 @@ def _step(self) -> DBMSConfigDelta:
2222
class PostgresConnTests(unittest.TestCase):
2323
@staticmethod
2424
def setUpClass() -> None:
25-
# If you're running the test locally, this check makes runs past the first one much faster.
26-
if not get_integtest_workspace_path().exists():
27-
subprocess.run(["./env/set_up_env_integtests.sh"], check=True)
25+
set_up_integtest_workspace()
2826

2927
@staticmethod
3028
def make_config(letter: str) -> DBMSConfigDelta:

env/integtest_util.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from pathlib import Path
2+
import subprocess
23

34
import yaml
45

@@ -8,6 +9,12 @@
89
INTEGTEST_DBGYM_CFG = DBGymConfig(ENV_INTEGTESTS_DBGYM_CONFIG_FPATH)
910

1011

12+
def set_up_integtest_workspace() -> None:
13+
# This if statement prevents us from setting up the workspace twice, which saves time.
14+
if not get_integtest_workspace_path().exists():
15+
subprocess.run(["./env/set_up_env_integtests.sh"], check=True)
16+
17+
1118
def get_integtest_workspace_path() -> Path:
1219
with open(ENV_INTEGTESTS_DBGYM_CONFIG_FPATH) as f:
1320
return Path(yaml.safe_load(f)["dbgym_workspace_path"])

0 commit comments

Comments
 (0)