-
Notifications
You must be signed in to change notification settings - Fork 0
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
4 changed files
with
230 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# @Author: José Sánchez-Gallego ([email protected]) | ||
# @Date: 2024-02-11 | ||
# @Filename: conftest.py | ||
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) | ||
|
||
from __future__ import annotations | ||
|
||
import pytest | ||
|
||
|
||
DBNAME: str = "sdss5db_too_test" | ||
|
||
|
||
@pytest.fixture(autouse=True, scope="session") | ||
def sdss5db(): | ||
"""A fixture that returns a connection to the ToO test database.""" | ||
|
||
from sdssdb.peewee import sdss5db | ||
|
||
sdss5db.database.connect(DBNAME) | ||
|
||
yield | ||
|
||
sdss5db.database.close() |
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,37 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
# | ||
# @Author: José Sánchez-Gallego ([email protected]) | ||
# @Date: 2024-02-11 | ||
# @Filename: test_database.py | ||
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) | ||
|
||
from __future__ import annotations | ||
|
||
from conftest import DBNAME | ||
from sdssdb.peewee.sdss5db import catalogdb | ||
|
||
|
||
def test_database_exists(): | ||
assert catalogdb.Catalog.table_exists() | ||
assert catalogdb.database.dbname == DBNAME | ||
|
||
n_catalog = catalogdb.Catalog.select().count() | ||
assert n_catalog > 1000000 and n_catalog < 10000000 | ||
|
||
|
||
def test_models_exist(): | ||
assert catalogdb.SDSS_DR13_PhotoObj.table_exists() | ||
assert catalogdb.CatalogToSDSS_DR13_PhotoObj_Primary.table_exists() # type: ignore | ||
assert catalogdb.SDSS_DR13_PhotoObj.select().count() > 1 | ||
assert catalogdb.CatalogToSDSS_DR13_PhotoObj_Primary.select().count() > 1 # type: ignore | ||
|
||
assert catalogdb.Gaia_DR3.table_exists() | ||
assert catalogdb.CatalogToGaia_DR3.table_exists() # type: ignore | ||
assert catalogdb.Gaia_DR3.select().count() > 1 | ||
assert catalogdb.CatalogToGaia_DR3.select().count() > 1 # type: ignore | ||
|
||
assert catalogdb.TwoMassPSC.table_exists() | ||
assert catalogdb.CatalogToTwoMassPSC.table_exists() # type: ignore | ||
assert catalogdb.TwoMassPSC.select().count() > 1 | ||
assert catalogdb.CatalogToTwoMassPSC.select().count() > 1 # type: ignore |