forked from c3-time-domain/SeeChange
-
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.
Fixture cleanup (c3-time-domain#144)
* carve off fixtures into files * add caching for fixtures * add fixtures for all pipeline objects * change column names from source_list to sources
- Loading branch information
Showing
74 changed files
with
3,777 additions
and
2,432 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
62 changes: 62 additions & 0 deletions
62
alembic/versions/2023_12_04_1307-4c2a7e8a525a_source_lists_to_sources.py
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,62 @@ | ||
"""source lists to sources | ||
Revision ID: 4c2a7e8a525a | ||
Revises: b53eed9ccb36 | ||
Create Date: 2023-12-04 13:07:43.519787 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '4c2a7e8a525a' | ||
down_revision = 'b53eed9ccb36' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('cutouts', sa.Column('sources_id', sa.BigInteger(), nullable=False)) | ||
op.drop_index('ix_cutouts_source_list_id', table_name='cutouts') | ||
op.create_index(op.f('ix_cutouts_sources_id'), 'cutouts', ['sources_id'], unique=False) | ||
op.drop_constraint('cutouts_source_list_id_fkey', 'cutouts', type_='foreignkey') | ||
op.create_foreign_key('cutouts_source_list_id_fkey', 'cutouts', 'source_lists', ['sources_id'], ['id']) | ||
op.drop_column('cutouts', 'source_list_id') | ||
op.add_column('world_coordinates', sa.Column('sources_id', sa.BigInteger(), nullable=False)) | ||
op.drop_index('ix_world_coordinates_source_list_id', table_name='world_coordinates') | ||
op.create_index(op.f('ix_world_coordinates_sources_id'), 'world_coordinates', ['sources_id'], unique=False) | ||
op.drop_constraint('world_coordinates_source_list_id_fkey', 'world_coordinates', type_='foreignkey') | ||
op.create_foreign_key('world_coordinates_source_list_id_fkey', 'world_coordinates', 'source_lists', ['sources_id'], ['id'], ondelete='CASCADE') | ||
op.drop_column('world_coordinates', 'source_list_id') | ||
op.add_column('zero_points', sa.Column('sources_id', sa.BigInteger(), nullable=False)) | ||
op.drop_index('ix_zero_points_source_list_id', table_name='zero_points') | ||
op.create_index(op.f('ix_zero_points_sources_id'), 'zero_points', ['sources_id'], unique=False) | ||
op.drop_constraint('zero_points_source_list_id_fkey', 'zero_points', type_='foreignkey') | ||
op.create_foreign_key('zero_points_source_list_id_fkey', 'zero_points', 'source_lists', ['sources_id'], ['id'], ondelete='CASCADE') | ||
op.drop_column('zero_points', 'source_list_id') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('zero_points', sa.Column('source_list_id', sa.BIGINT(), autoincrement=False, nullable=False)) | ||
op.drop_constraint('zero_points_source_list_id_fkey', 'zero_points', type_='foreignkey') | ||
op.create_foreign_key('zero_points_source_list_id_fkey', 'zero_points', 'source_lists', ['source_list_id'], ['id'], ondelete='CASCADE') | ||
op.drop_index(op.f('ix_zero_points_sources_id'), table_name='zero_points') | ||
op.create_index('ix_zero_points_source_list_id', 'zero_points', ['source_list_id'], unique=False) | ||
op.drop_column('zero_points', 'sources_id') | ||
op.add_column('world_coordinates', sa.Column('source_list_id', sa.BIGINT(), autoincrement=False, nullable=False)) | ||
op.drop_constraint('world_coordinates_source_list_id_fkey', 'world_coordinates', type_='foreignkey') | ||
op.create_foreign_key('world_coordinates_source_list_id_fkey', 'world_coordinates', 'source_lists', ['source_list_id'], ['id'], ondelete='CASCADE') | ||
op.drop_index(op.f('ix_world_coordinates_sources_id'), table_name='world_coordinates') | ||
op.create_index('ix_world_coordinates_source_list_id', 'world_coordinates', ['source_list_id'], unique=False) | ||
op.drop_column('world_coordinates', 'sources_id') | ||
op.add_column('cutouts', sa.Column('source_list_id', sa.BIGINT(), autoincrement=False, nullable=False)) | ||
op.drop_constraint('cutouts_source_list_id_fkey', 'cutouts', type_='foreignkey') | ||
op.create_foreign_key('cutouts_source_list_id_fkey', 'cutouts', 'source_lists', ['source_list_id'], ['id']) | ||
op.drop_index(op.f('ix_cutouts_sources_id'), table_name='cutouts') | ||
op.create_index('ix_cutouts_source_list_id', 'cutouts', ['source_list_id'], unique=False) | ||
op.drop_column('cutouts', 'sources_id') | ||
# ### end Alembic commands ### |
36 changes: 36 additions & 0 deletions
36
alembic/versions/2023_12_06_1203-f831276c00e2_add_bitflag_to_zeropoint.py
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,36 @@ | ||
"""add bitflag to zeropoint | ||
Revision ID: f831276c00e2 | ||
Revises: 4c2a7e8a525a | ||
Create Date: 2023-12-06 12:03:29.031978 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = 'f831276c00e2' | ||
down_revision = '4c2a7e8a525a' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.add_column('zero_points', sa.Column('_bitflag', sa.BIGINT(), nullable=False)) | ||
op.add_column('zero_points', sa.Column('description', sa.Text(), nullable=True)) | ||
op.add_column('zero_points', sa.Column('_upstream_bitflag', sa.BIGINT(), nullable=False)) | ||
op.create_index(op.f('ix_zero_points__bitflag'), 'zero_points', ['_bitflag'], unique=False) | ||
op.create_index(op.f('ix_zero_points__upstream_bitflag'), 'zero_points', ['_upstream_bitflag'], unique=False) | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_index(op.f('ix_zero_points__upstream_bitflag'), table_name='zero_points') | ||
op.drop_index(op.f('ix_zero_points__bitflag'), table_name='zero_points') | ||
op.drop_column('zero_points', '_upstream_bitflag') | ||
op.drop_column('zero_points', 'description') | ||
op.drop_column('zero_points', '_bitflag') | ||
# ### end Alembic commands ### |
30 changes: 30 additions & 0 deletions
30
alembic/versions/2023_12_08_1140-360a5ebe3848_cascade_foreign_key_deletion_on_source_.py
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,30 @@ | ||
"""cascade foreign key deletion on source list | ||
Revision ID: 360a5ebe3848 | ||
Revises: f831276c00e2 | ||
Create Date: 2023-12-08 11:40:17.861309 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '360a5ebe3848' | ||
down_revision = 'f831276c00e2' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint('source_lists_image_id_fkey', 'source_lists', type_='foreignkey') | ||
op.create_foreign_key('source_lists_image_id_fkey', 'source_lists', 'images', ['image_id'], ['id'], ondelete='CASCADE') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.drop_constraint('source_lists_image_id_fkey', 'source_lists', type_='foreignkey') | ||
op.create_foreign_key('source_lists_image_id_fkey', 'source_lists', 'images', ['image_id'], ['id']) | ||
# ### end Alembic commands ### |
38 changes: 0 additions & 38 deletions
38
data/test_data/DECam_examples/c4d_20221104_074232_N1_g_Sci_VWQNR2.image.yaml
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
data/test_data/DECam_examples/c4d_20221104_074232_N1_g_Sci_VWQNR2.psf.yaml
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
data/test_data/DECam_examples/c4d_20221104_074232_N1_g_Sci_VWQNR2.sources.yaml
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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,45 @@ | ||
## Testing | ||
|
||
Tests are an integral part of the development process. | ||
We run mostly unit tests that test specific parts of the code, | ||
but a few integration tests are also included (end-to-end tests). | ||
We plan to add some regression tests that verify the results | ||
of the pipeline are consistent with previous code versions. | ||
|
||
### Running tests | ||
|
||
To run the tests, simply run the following command from the root directory of the project: | ||
|
||
```bash | ||
pytest | ||
``` | ||
|
||
To run the tests in a dockerized environment, see the setup.md file, under "Running tests". | ||
|
||
### Test caching and data folders | ||
|
||
Some of our tests require large datasets (mostly images). | ||
We include a few example images in the repo itself, | ||
but most of the required data is lazy downloaded from | ||
the appropriate servers (e.g., from Noirlab). | ||
|
||
To avoid downloading the same data over and over again, | ||
we cache the data in the `data/cache` folder. | ||
To make sure the downloading process works as expected, | ||
users can choose to delete this folder. | ||
In the tests, the path to this folder is given by | ||
the `cache_dir` fixture. | ||
|
||
Note that the persistent data, that comes with the | ||
repo, is anything else in the `data` folder, | ||
which is pointed to by the `persistent_dir` fixture. | ||
|
||
Finally, the working directory for local storage, | ||
which is referenced by the `FileOnDiskMixin.local_path` | ||
class variable, is defined in the test config YAML file, | ||
and can be accessed using the `data_dir` fixture. | ||
This folder is systematically wiped when the tests | ||
are completed. | ||
|
||
|
||
|
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
Oops, something went wrong.