-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
integtest workspace now creates dbgym config after creating workspace
- Loading branch information
1 parent
66174eb
commit 4ae2d85
Showing
4 changed files
with
44 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
import subprocess | ||
from pathlib import Path | ||
from typing import Optional | ||
|
||
import yaml | ||
|
||
from util.workspace import DBGymConfig | ||
|
||
ENV_INTEGTESTS_DBGYM_CONFIG_FPATH = Path("env/env_integtests_dbgym_config.yaml") | ||
INTEGTEST_DBGYM_CFG = DBGymConfig(ENV_INTEGTESTS_DBGYM_CONFIG_FPATH) | ||
|
||
class IntegtestWorkspace: | ||
""" | ||
This is essentially a singleton class. This avoids multiple integtest_*.py files creating | ||
the workspace and/or the DBGymConfig redundantly. | ||
""" | ||
|
||
def set_up_integtest_workspace() -> None: | ||
# This if statement prevents us from setting up the workspace twice, which saves time. | ||
if not get_integtest_workspace_path().exists(): | ||
subprocess.run(["./env/set_up_env_integtests.sh"], check=True) | ||
ENV_INTEGTESTS_DBGYM_CONFIG_FPATH = Path("env/env_integtests_dbgym_config.yaml") | ||
INTEGTEST_DBGYM_CFG: Optional[DBGymConfig] = None | ||
|
||
@staticmethod | ||
def set_up_workspace() -> None: | ||
# This if statement prevents us from setting up the workspace twice, which saves time. | ||
if not IntegtestWorkspace.get_workspace_path().exists(): | ||
subprocess.run(["./env/set_up_env_integtests.sh"], check=True) | ||
|
||
def get_integtest_workspace_path() -> Path: | ||
with open(ENV_INTEGTESTS_DBGYM_CONFIG_FPATH) as f: | ||
return Path(yaml.safe_load(f)["dbgym_workspace_path"]) | ||
assert False | ||
# The DBGymConfig needs to be created after running ./env/set_up_env_integtests.sh so | ||
# that it is created correctly. | ||
IntegtestWorkspace.INTEGTEST_DBGYM_CFG = DBGymConfig( | ||
IntegtestWorkspace.ENV_INTEGTESTS_DBGYM_CONFIG_FPATH | ||
) | ||
|
||
@staticmethod | ||
def get_dbgym_cfg() -> DBGymConfig: | ||
assert IntegtestWorkspace.INTEGTEST_DBGYM_CFG is not None | ||
return IntegtestWorkspace.INTEGTEST_DBGYM_CFG | ||
|
||
@staticmethod | ||
def get_workspace_path() -> Path: | ||
with open(IntegtestWorkspace.ENV_INTEGTESTS_DBGYM_CONFIG_FPATH) as f: | ||
return Path(yaml.safe_load(f)["dbgym_workspace_path"]) | ||
assert False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters