-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
58 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
import agml.backend.config as cfg | ||
|
||
|
||
def test_config_setup(): | ||
"""Test that the config directory is set up correctly.""" | ||
tmp_config_dir = Path(os.getenv("AGML_CONFIG_DIR")) | ||
# Check if the config directory exists | ||
assert tmp_config_dir.exists() | ||
|
||
# Check that the SUPER_BASE_DIR is set correctly | ||
assert cfg.SUPER_BASE_DIR == tmp_config_dir | ||
|
||
# Check that the default config file is created and valid parameters are accessible | ||
default_config_file = tmp_config_dir / "config.json" | ||
assert default_config_file.exists() | ||
|
||
assert cfg.data_save_path() == cfg._get_config("data_path") | ||
assert cfg.model_save_path() == cfg._get_config("model_path") | ||
assert cfg.synthetic_data_save_path() == cfg._get_config("synthetic_data_path") | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
from pathlib import Path | ||
import shutil | ||
|
||
import pytest | ||
|
||
from pytest import TempPathFactory | ||
|
||
|
||
def pytest_sessionstart(session): | ||
""" | ||
Called before the whole run, right before | ||
returning the exit status to the system. | ||
""" | ||
tmp_path_factory: TempPathFactory = session.config._tmp_path_factory | ||
tmp_config_dir: Path = tmp_path_factory.mktemp("agml") | ||
os.environ["AGML_CONFIG_DIR"] = str(tmp_config_dir) |
This file was deleted.
Oops, something went wrong.