Skip to content
Snippets Groups Projects

WS-543: removed cruft; fixed issues found by IJ code analysis, SonarLint, and pylint

Merged Janet Goldstein requested to merge WS-543-clean-up-2021-07-22pm into main
1 file
+ 6
42
Compare changes
  • Side-by-side
  • Inline
@@ -7,7 +7,7 @@ import json
import logging
import shutil
import sys
from pathlib import Path, PurePath
from pathlib import Path
# pylint: disable=E0401, E0402, R1721, W0621
@@ -19,7 +19,6 @@ from ingest_envoy.ingestion_manifest import (
)
from ingest_envoy.manifest_components import (
IngestionManifestKey,
ParamsKey,
InputScienceProduct,
InputGroup,
ManifestParameters,
@@ -29,7 +28,6 @@ from ingest_envoy.manifest_components import (
TARFILE_EXT,
ARTIFACT_NAME,
WEBLOG_FILENAME,
MANIFEST_FILENAME,
)
from ingest_envoy.utilities import (
ScienceProductType,
@@ -69,9 +67,9 @@ def test_filters_cal_input_files(ingest_path: Path):
populate_fake_evla_cal_ingest_path(ingest_path)
locator = "uid://evla/calibration/twinkle-twinkle-little-quasar"
manifest, _ = IngestionManifestBuilder(
telescope=Telescope.EVLA,
telescope=Telescope.EVLA.value,
staging_source_dir=ingest_path,
sp_type=ScienceProductType.EVLA_CAL,
sp_type=ScienceProductType.EVLA_CAL.value,
locator=locator,
).build()
@@ -117,7 +115,7 @@ def test_writes_expected_output_files(ingest_path: Path):
telescope=Telescope.EVLA.value,
staging_source_dir=ingest_path,
locator="uid://evla/calibration/fee-fi-fo-fum-acdf23",
sp_type=ScienceProductType.EVLA_CAL,
sp_type=ScienceProductType.EVLA_CAL.value,
).build()
assert manifest_file
assert manifest
@@ -327,52 +325,18 @@ def test_evla_cal_manifest_matches_example(ingest_path: Path):
builder = IngestionManifestBuilder(
staging_source_dir=ingest_path,
telescope=Telescope.EVLA.value,
sp_type=ScienceProductType.EVLA_CAL,
sp_type=ScienceProductType.EVLA_CAL.value,
locator="uid://evla/execblock/48ba4c9d-d7c7-4a8f-9803-1115cd52459b",
)
manifest, manifest_file = builder.build()
_, manifest_file = builder.build()
with open(manifest_file, "r") as infile:
actual_json = dict(json.load(infile).items())
print(actual_json)
actual_json[IngestionManifestKey.PARAMETERS.value][
IngestionManifestKey.INGESTION_PATH.value
] = expected_dir_name
assert (
actual_json[IngestionManifestKey.PARAMETERS.value]
== expected_json[IngestionManifestKey.PARAMETERS.value]
)
# actual_sps = actual_json[IngestionManifestKey.INPUT_GROUP.value]
actual_ig = actual_json[IngestionManifestKey.INPUT_GROUP.value]
expected_ig = expected_json[IngestionManifestKey.INPUT_GROUP.value]
assert actual_ig == expected_ig
# expected_sps = expected_json[IngestionManifestKey.INPUT_GROUP.value]
# assert actual_sps == expected_sps
# assert (
# actual_json[IngestionManifestKey.INPUT_GROUP.value][IngestionManifestKey.INPUT_GROUP.value]
# == expected_json[IngestionManifestKey.INPUT_GROUP.value]
# )
actual_og = actual_json[IngestionManifestKey.OUTPUT_GROUP.value]
expected_og = expected_json[IngestionManifestKey.OUTPUT_GROUP.value]
assert actual_og == expected_og
# assert (
# actual_og[IngestionManifestKey.SCIENCE_PRODUCTS.value]
# == expected_og[IngestionManifestKey.SCIENCE_PRODUCTS.value]
# )
#
# assert (
# actual_og[IngestionManifestKey.ANCILLARY_PRODUCTS.value]
# == expected_og[IngestionManifestKey.ANCILLARY_PRODUCTS.value]
# )
# TODO:
assert actual_json == expected_json
shutil.rmtree(ingest_path)
Loading