Skip to content

Commit

Permalink
Fixes to e2e tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
cmccully committed Feb 21, 2024
1 parent 647c802 commit 47b9772
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: Test Master Bias Creation
run: |
kubectl exec banzai-e2e-test -c banzai-listener -- pytest -o log_cli=true -s --pyargs banzai.tests --durations=0 --junitxml=/archive/engineering/pytest-master-bias.xml -m master_bias
kubectl exec banzai-e2e-test -c banzai-listener -- pytest -o log_cli=true -s --pyargs banzai --durations=0 --junitxml=/archive/engineering/pytest-master-bias.xml -m master_bias
- name: Cleanup
run: |
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ prune docs/_build
prune docs/api

include pyproject.toml
include pytest.ini
4 changes: 2 additions & 2 deletions banzai/photometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def do_stage(self, image):
npixels=self.min_area, nlevels=32,
contrast=0.005, progress_bar=False,
nproc=1, mode='sinh')
logger.info('Finished deblending. Estimat', image=image)
logger.info('Finished deblending. Saving catalog', image=image)
# Convert the segmentation map to a source catalog
catalog = SourceCatalog(data, deblended_seg_map, convolved_data=convolved_data, error=error,
background=bkg.background)
Expand Down Expand Up @@ -141,7 +141,7 @@ def do_stage(self, image):
# Flag = 4 for sources that have saturated pixels
flag_sources(sources, catalog.labels, deblended_seg_map, image.mask, flag=4, mask_value=2)
# Flag = 8 if kron aperture falls off the image
flag_edge_sources(image, sources, flag_pixel=8)
flag_edge_sources(image, sources, flag_value=8)
# Flag = 16 if source has cosmic ray pixels
flag_sources(sources, catalog.labels, deblended_seg_map, image.mask, flag=16, mask_value=8)

Expand Down
2 changes: 1 addition & 1 deletion banzai/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
'elp': {'minute': 0, 'hour': 23},
'ogg': {'minute': 0, 'hour': 3}}

ASTROMETRY_SERVICE_URL = os.getenv('ASTROMETRY_SERVICE_URL', 'http://astrometry.lco.gtn/catalog/')
ASTROMETRY_SERVICE_URL = os.getenv('ASTROMETRY_SERVICE_URL', ' ')

CALIBRATION_FILENAME_FUNCTIONS = {'BIAS': ('banzai.utils.file_utils.config_to_filename',
'banzai.utils.file_utils.ccdsum_to_filename'),
Expand Down
8 changes: 4 additions & 4 deletions banzai/tests/test_end_to_end.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def get_expected_number_of_calibrations(raw_filename_pattern, calibration_type):
if site in frame['filename'] and instrument in frame['filename']
and dayobs in frame['filename'] and raw_filename_pattern in frame['filename']
]
if 'calibration_type.lower()' == 'skyflat':
if calibration_type.lower() == 'skyflat':
# Group by filter
observed_filters = []
for frame in raw_frames_for_this_dayobs:
Expand Down Expand Up @@ -244,7 +244,7 @@ def test_if_stacked_flat_frame_was_created(self):
@pytest.mark.e2e
@pytest.mark.science_files
class TestScienceFileCreation:
@pytest.fixture(autouse=True)
@pytest.fixture(autouse=True, scope='class')
@mock.patch('banzai.utils.observation_utils.requests.get', side_effect=observation_portal_side_effect)
def reduce_science_frames(self, mock_observation_portal):
run_reduce_individual_frames('e00.fits')
Expand All @@ -254,7 +254,7 @@ def test_if_science_frames_were_created(self):
created_files = []
for day_obs in DAYS_OBS:
expected_files += [filename.replace('e00', 'e91')
for filename in TEST_FRAMES['filename']]
for filename in TEST_FRAMES['filename'] if 'e00.fits' in filename]
created_files += [os.path.basename(filename) for filename in glob(os.path.join(DATA_ROOT, day_obs,
'processed', '*e91*'))]
assert len(expected_files) > 0
Expand All @@ -266,6 +266,6 @@ def test_that_photometric_calibration_succeeded(self):
for day_obs in DAYS_OBS:
science_files += [filepath for filepath in glob(os.path.join(DATA_ROOT, day_obs,
'processed', '*e91*'))]
zeropoints = [fits.open(file)['SCI'].header.get('L1ZP') for file in science_files]
zeropoints = [fits.open(filename)['SCI'].header.get('L1ZP') for filename in science_files]
# check that at least one of our images contains a zeropoint
assert zeropoints.count(None) != len(zeropoints)
12 changes: 6 additions & 6 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[pytest]
minversion = 3.5
norecursedirs = build docs/_build
doctest_plus = enabled
addopts = -p no:warnings
minversion = "3.5"
norecursedirs = "build docs/_build"
doctest_plus = "enabled"
addopts = "-p no:warnings"
log_cli = True
log_level = info
log_cli_level = info
log_level = "info"
log_cli_level = "info"
markers =
# E2E test markers
e2e : End-to-end test suite
Expand Down

0 comments on commit 47b9772

Please sign in to comment.