File tree Expand file tree Collapse file tree 3 files changed +43
-58
lines changed Expand file tree Collapse file tree 3 files changed +43
-58
lines changed Original file line number Diff line number Diff line change 1+ import os
2+ from pathlib import Path
3+
4+ import pytest
5+
6+ import agml .backend .config as cfg
7+
8+
9+ def test_config_setup ():
10+ """Test that the config directory is set up correctly."""
11+ tmp_config_dir = Path (os .getenv ("AGML_CONFIG_DIR" ))
12+ # Check if the config directory exists
13+ assert tmp_config_dir .exists ()
14+
15+ # Check that the SUPER_BASE_DIR is set correctly
16+ assert cfg .SUPER_BASE_DIR == tmp_config_dir
17+
18+ # Check that the default config file is created and valid parameters are accessible
19+ default_config_file = tmp_config_dir / "config.json"
20+ assert default_config_file .exists ()
21+
22+ assert cfg .data_save_path () == cfg ._get_config ("data_path" )
23+ assert cfg .model_save_path () == cfg ._get_config ("model_path" )
24+ assert cfg .synthetic_data_save_path () == cfg ._get_config ("synthetic_data_path" )
25+
26+
Original file line number Diff line number Diff line change 1+ import os
2+ from pathlib import Path
3+ import shutil
4+
5+ import pytest
6+
7+ from pytest import TempPathFactory
8+
9+
10+ def pytest_sessionstart (session ):
11+ """
12+ Called before the whole run, right before
13+ returning the exit status to the system.
14+ """
15+ tmp_path_factory : TempPathFactory = session .config ._tmp_path_factory
16+ tmp_config_dir : Path = tmp_path_factory .mktemp ("agml" )
17+ os .environ ["AGML_CONFIG_DIR" ] = str (tmp_config_dir )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments