extend settings
This commit is contained in:
@@ -1,6 +1,14 @@
|
|||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from pydantic_core import Url
|
from pydantic_core import Url
|
||||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
|
||||||
|
PHOTOOLS3_DIR = Path(__file__).parent.resolve()
|
||||||
|
SRC_DIR = PHOTOOLS3_DIR.parent
|
||||||
|
ROOT_DIR = SRC_DIR.parent
|
||||||
|
EXAMPLES_DIR = ROOT_DIR / "examples"
|
||||||
|
DNG_EXAMPLES_DIR = EXAMPLES_DIR / "dng"
|
||||||
|
|
||||||
|
|
||||||
class Settings(BaseSettings):
|
class Settings(BaseSettings):
|
||||||
model_config = SettingsConfigDict(env_file=".env")
|
model_config = SettingsConfigDict(env_file=".env")
|
||||||
|
|||||||
+32
-1
@@ -1,7 +1,38 @@
|
|||||||
from photools3.settings import Settings
|
from pathlib import Path
|
||||||
|
|
||||||
|
from photools3.settings import (
|
||||||
|
DNG_EXAMPLES_DIR,
|
||||||
|
EXAMPLES_DIR,
|
||||||
|
PHOTOOLS3_DIR,
|
||||||
|
ROOT_DIR,
|
||||||
|
SRC_DIR,
|
||||||
|
Settings,
|
||||||
|
)
|
||||||
|
|
||||||
settings = Settings()
|
settings = Settings()
|
||||||
|
|
||||||
|
|
||||||
|
def test_photools3_dir():
|
||||||
|
assert PHOTOOLS3_DIR == Path(__file__).parent.parent.resolve() / "src" / "photools3"
|
||||||
|
|
||||||
|
|
||||||
|
def test_src_dir():
|
||||||
|
assert SRC_DIR == Path(__file__).parent.parent.resolve() / "src"
|
||||||
|
|
||||||
|
|
||||||
|
def test_root_dir():
|
||||||
|
assert ROOT_DIR == Path(__file__).parent.parent.resolve()
|
||||||
|
|
||||||
|
|
||||||
|
def test_examples_dir():
|
||||||
|
assert EXAMPLES_DIR == Path(__file__).parent.parent.resolve() / "examples"
|
||||||
|
|
||||||
|
|
||||||
|
def test_dng_examples_dir():
|
||||||
|
assert (
|
||||||
|
DNG_EXAMPLES_DIR == Path(__file__).parent.parent.resolve() / "examples" / "dng"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def test_settings_base():
|
def test_settings_base():
|
||||||
assert settings.llm_api_base_url
|
assert settings.llm_api_base_url
|
||||||
|
|||||||
Reference in New Issue
Block a user