6767_granule_metadata_metop_b = {"platform_name" : "Metop-B" ,
6868 "sensor" : "avhrr" }
6969
70+
7071def granule_metadata (s_min ):
7172 """Return common granule_metadata dictionary."""
7273 return {** _granule_metadata ,
@@ -125,17 +126,29 @@ def europe_collector_schedule_cut_custom_method_failed(europe, schedule_cut=True
125126 return RegionCollector (europe , schedule_cut = schedule_cut , schedule_cut_method = schedule_cut_method )
126127
127128
128- def _fakeopen (url ):
129+ def _fakeopen_celestrak (url ):
129130 return io .BytesIO (tles )
130131
131132
133+ ears_avhrr_pass_predictions = b"""EARS-AVHRR Pass Predictions
134+ 2025/06/19 05:01:28
135+ regionBeginEumetsat,regionEndEumetsat,Satellite
136+ 2025-06-19 00:20,2025-06-19 00:37,metopc
137+ 2025-06-19 01:10,2025-06-19 01:28,metopb
138+ """
139+
140+
141+ def _fakeopen_eum (url ):
142+ return io .BytesIO (ears_avhrr_pass_predictions )
143+
144+
132145def test_init (europe ):
133146 """Test that initialisation appears to work."""
134147 from pytroll_collectors .region_collector import RegionCollector
135148 RegionCollector (europe )
136149
137150
138- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
151+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
139152def test_collect (europe_collector , caplog ):
140153 """Test that granules can be collected."""
141154 with caplog .at_level (logging .DEBUG ):
@@ -150,7 +163,7 @@ def test_collect(europe_collector, caplog):
150163 assert "Granule file://18 is not overlapping euro_ma"
151164
152165
153- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
166+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
154167def test_collect_duration (europe ):
155168 """Test with tle_platform_name, without end_time, using call syntax."""
156169 from pytroll_collectors .region_collector import RegionCollector
@@ -165,7 +178,8 @@ def test_collect_duration(europe):
165178 alt_europe_collector (granule_metadata )
166179
167180
168- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
181+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
182+ @unittest .mock .patch ("pytroll_collectors.harvest_EUM_schedules.urlopen" , new = _fakeopen_eum )
169183def test_collect_check_schedules (europe_collector_schedule_cut , caplog ):
170184 """Test default schedule cut method."""
171185 with caplog .at_level (logging .DEBUG ):
@@ -180,7 +194,7 @@ def test_collect_check_schedules(europe_collector_schedule_cut, caplog):
180194 assert "harvest_EUM_schedules.py'>, with type <class 'module'>" in caplog .text
181195
182196
183- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
197+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
184198def test_collect_check_schedules_custom_method (europe_collector_schedule_cut_custom_method , caplog ):
185199 """Test custom schedule cut method."""
186200 with caplog .at_level (logging .DEBUG ):
@@ -196,7 +210,7 @@ def test_collect_check_schedules_custom_method(europe_collector_schedule_cut_cus
196210 assert "test_region_collector.py'>, with type <class 'module'>" in caplog .text
197211
198212
199- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
213+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
200214def test_collect_check_schedules_custom_method_failed (europe_collector_schedule_cut_custom_method_failed , caplog ):
201215 """Test custom schedule cut method failed import."""
202216 with caplog .at_level (logging .DEBUG ):
@@ -208,16 +222,16 @@ def test_collect_check_schedules_custom_method_failed(europe_collector_schedule_
208222 assert test_string in caplog .text
209223
210224
211- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
225+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
212226def test_collect_missing_tle_from_file (europe_collector , caplog ):
213- """Test that granules can be collected, but missing TLE raises and exception"""
227+ """Test that granules can be collected, but missing TLE raises and exception. """
214228 with caplog .at_level (logging .DEBUG ):
215229 for s_min in (0 , 3 , 6 , 9 , 12 , 15 , 18 ):
216230 with pytest .raises (KeyError ):
217231 europe_collector .collect ({** granule_metadata_metop_b (s_min )})
218232
219233
220- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
234+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
221235def test_adjust_timeout (europe , caplog ):
222236 """Test timeout adjustment."""
223237 from pytroll_collectors .region_collector import RegionCollector
@@ -241,7 +255,7 @@ def test_adjust_timeout(europe, caplog):
241255
242256
243257@pytest .mark .skip (reason = "test never finishes" )
244- @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen )
258+ @unittest .mock .patch ("pyorbital.tlefile.urlopen" , new = _fakeopen_celestrak )
245259def test_faulty_end_time (europe_collector , caplog ):
246260 """Test adapting if end_time before start_time."""
247261 granule_metadata = {
0 commit comments