Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions data/reference/Versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,12 @@
"end_date": "2026-04-14",
"description": "Spectra provided by BONES Archive"
},
{
"version": "5.4.2026.02",
"start_date": "2026-04-14",
"end_date": "2026-04-14",
"description": "Add database.toml"
},
{
"version": "latest",
"start_date": "2026-04-14",
Expand Down
11 changes: 7 additions & 4 deletions simple/__init__.py → database.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
db_name = "simple_tests"
data_path = "data/"
felis_path = "schema.yaml"

REFERENCE_TABLES = [
lookup_tables = [
"Publications",
"Telescopes",
"Instruments",
"Parameters",
"PhotometryFilters",
"Versions",
"Parameters",
"RegimeList",
"CompanionList"
]
"CompanionList",
]
File renamed without changes.
24 changes: 6 additions & 18 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,22 @@
import sys

import pytest
from astrodb_utils import load_astrodb
from astrodb_utils.loaders import build_db_from_json, DatabaseSettings
from astrodbkit.astrodb import Database, create_database

sys.path.append("./") # needed for github actions to find the simple module
from simple import REFERENCE_TABLES

logger = logging.getLogger("AstroDB")

SCHEMA_PATH = "simple/schema.yaml"

db_settings=DatabaseSettings(settings_file="database.toml")
SCHEMA_PATH = db_settings.felis_path

# Create a fresh SIMPLE database for the data and integrity tests
@pytest.fixture(scope="session", autouse=True)
def db():
DB_NAME = "tests/simple_tests.sqlite"
DB_PATH = "data"

if os.path.exists(DB_NAME):
os.remove(DB_NAME)
connection_string = "sqlite:///" + DB_NAME
create_database(connection_string, felis_schema=SCHEMA_PATH)
assert os.path.exists(DB_NAME)

# Connect to the new database
db = load_astrodb(DB_NAME,
data_path=DB_PATH,
reference_tables=REFERENCE_TABLES,
felis_schema=SCHEMA_PATH)
db = build_db_from_json(
settings_file="database.toml"
)

return db

Expand Down
6 changes: 3 additions & 3 deletions tests/test_felis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import yaml
from pydantic import ValidationError

from astrodb_utils.loaders import DatabaseSettings
from felis.datamodel import Schema

SCHEMA_PATH = "simple/schema.yaml"

db_settings=DatabaseSettings(settings_file="database.toml")
SCHEMA_PATH = db_settings.felis_path

def test_schema():
data = yaml.safe_load(open(SCHEMA_PATH, "r"))
Expand Down
Loading