Skip to content

Commit

Permalink
Fix test to include the testing of running the main script with comma…
Browse files Browse the repository at this point in the history
…nd line args

Signed-off-by: Adam.Dybbroe <[email protected]>
  • Loading branch information
Adam.Dybbroe committed Dec 4, 2024
1 parent c949c58 commit 5243dbe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion trollsched/shapefiles_from_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def parse_args(args):
"verbose logging). WARN=0, INFO=1, "
"DEBUG=2. This is overridden by the log config file if specified.")

return parser.parse_args()
return parser.parse_args(args)


def run(args=None):
Expand Down
14 changes: 8 additions & 6 deletions trollsched/tests/test_pass_outlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
create_shapefile_filename,
create_shapefile_from_pass,
get_shapely_polygon_from_lonlat,
shapefiles_from_schedule_xml_requests,
run,
)

CONT_POLY_LON = np.array([-2.13452262, -2.29587336, -2.71901413, 2.49884179, 1.84466852,
Expand Down Expand Up @@ -97,13 +97,15 @@ def test_create_shapefile_from_pass(fake_noaa20_viirs_pass_instance, tmp_path):

@pytest.mark.usefixtures("fake_long_tle_file")
@pytest.mark.usefixtures("fake_xml_schedule_file")
def test_shapefiles_from_schedule_xml_requests(fake_xml_schedule_file, fake_long_tle_file, tmp_path):
"""Test create shapefiles from an xml schedule request file."""
def test_create_shapefiles_from_schedule(fake_xml_schedule_file, fake_long_tle_file, tmp_path):
"""Test running the script to create shapefiles from an xml schedule request file."""
output_dir = tmp_path / "results"
output_dir.mkdir()
satellites = ["Suomi NPP", "NOAA 18", "NOAA-20"]
shapefiles_from_schedule_xml_requests(str(fake_xml_schedule_file), satellites,
str(fake_long_tle_file), str(output_dir))

args = ["-s", "Suomi NPP", "NOAA 18", "NOAA-20", "-t", str(fake_long_tle_file),
"-x", str(fake_xml_schedule_file),
"-o", str(output_dir)]
run(args)

n18files = [str(name) for name in output_dir.glob("avhrr_NOAA-18_202412022201_202412022216_outline.*")]
assert len(n18files) == 5
Expand Down

0 comments on commit 5243dbe

Please sign in to comment.