@@ -39,7 +39,7 @@ def test_single_file_relpath(self, tmp_path):
3939
4040 # Run
4141 files_to_process , result = rimport .get_files_to_process (
42- file = filename , filelist = None
42+ file = filename , filelist = None , items_to_process = None ,
4343 )
4444
4545 # Verify
@@ -60,7 +60,7 @@ def test_single_file_abspath(self, tmp_path):
6060
6161 # Run
6262 files_to_process , result = rimport .get_files_to_process (
63- file = test_file , filelist = None
63+ file = test_file , filelist = None , items_to_process = None ,
6464 )
6565
6666 # Verify
@@ -87,7 +87,7 @@ def test_filelist_relpath_with_relpaths(self, tmp_path):
8787
8888 # Run
8989 files_to_process , result = rimport .get_files_to_process (
90- file = None , filelist = filelist_relpath
90+ file = None , filelist = filelist_relpath , items_to_process = None ,
9191 )
9292
9393 # Verify
@@ -113,7 +113,7 @@ def test_filelist_abspath_with_relpaths(self, tmp_path):
113113
114114 # Run
115115 files_to_process , result = rimport .get_files_to_process (
116- file = None , filelist = filelist
116+ file = None , filelist = filelist , items_to_process = None ,
117117 )
118118
119119 # Verify
@@ -140,7 +140,7 @@ def test_filelist_relpath_with_abspaths(self, tmp_path):
140140
141141 # Run
142142 files_to_process , result = rimport .get_files_to_process (
143- file = None , filelist = filelist_relpath
143+ file = None , filelist = filelist_relpath , items_to_process = None ,
144144 )
145145
146146 # Verify
@@ -166,7 +166,7 @@ def test_filelist_abspath_with_abspaths(self, tmp_path):
166166
167167 # Run
168168 files_to_process , result = rimport .get_files_to_process (
169- file = None , filelist = filelist
169+ file = None , filelist = filelist , items_to_process = None ,
170170 )
171171
172172 # Verify
@@ -178,7 +178,7 @@ def test_filelist_not_found(self):
178178 filelist = "bsfearirn"
179179 assert not os .path .exists (filelist )
180180 files_to_process , result = rimport .get_files_to_process (
181- file = None , filelist = filelist
181+ file = None , filelist = filelist , items_to_process = None ,
182182 )
183183 assert result == 2
184184 assert files_to_process is None
@@ -188,11 +188,81 @@ def test_filelist_empty(self, tmp_path):
188188 filelist = tmp_path / "bsfearirn"
189189 filelist .write_text ("" )
190190 files_to_process , result = rimport .get_files_to_process (
191- file = None , filelist = filelist
191+ file = None , filelist = filelist , items_to_process = [],
192192 )
193193 assert result == 2
194194 assert files_to_process is None
195195
196+ def test_items_to_process_abspaths (self , tmp_path ):
197+ """Test giving it a list of absolute paths in items_to_process"""
198+ # Setup
199+ inputdata_root = tmp_path / "inputdata"
200+ inputdata_root .mkdir ()
201+ staging_root = tmp_path / "staging"
202+ staging_root .mkdir ()
203+
204+ filenames = []
205+ for i in range (2 ):
206+ filename = inputdata_root / f"test{ i } .txt"
207+ filenames .append (str (filename ))
208+ filename .write_text ("def567" )
209+
210+ # Run
211+ files_to_process , result = rimport .get_files_to_process (
212+ file = None , filelist = None , items_to_process = filenames ,
213+ )
214+
215+ # Verify
216+ assert result == 0
217+ assert files_to_process == filenames
218+
219+ def test_items_to_process_relpaths (self , tmp_path ):
220+ """Test giving it a list of relative paths in items_to_process"""
221+ # Setup
222+ inputdata_root = tmp_path / "inputdata"
223+ inputdata_root .mkdir ()
224+
225+ filenames = []
226+ for i in range (2 ):
227+ filename = inputdata_root / f"test{ i } .txt"
228+ filenames .append (os .path .basename (filename ))
229+ filename .write_text ("def567" )
230+
231+ # Run
232+ files_to_process , result = rimport .get_files_to_process (
233+ file = None , filelist = None , items_to_process = filenames ,
234+ )
235+
236+ # Verify
237+ assert result == 0
238+ assert files_to_process == filenames
239+
240+ def test_items_to_process_mixpaths (self , tmp_path ):
241+ """Test giving it a list of absolute and relative paths in items_to_process"""
242+ # Setup
243+ inputdata_root = tmp_path / "inputdata"
244+ inputdata_root .mkdir ()
245+
246+ filenames = []
247+ for i in range (2 ):
248+ filename = inputdata_root / f"test{ i } .txt"
249+ filenames .append (os .path .basename (filename ))
250+ filename .write_text ("def567" )
251+ for i in range (2 ):
252+ filename = inputdata_root / f"test{ 2 * i } .txt"
253+ filenames .append (str (filename ))
254+ filename .write_text ("def567" )
255+ assert len (filenames ) == 4
256+
257+ # Run
258+ files_to_process , result = rimport .get_files_to_process (
259+ file = None , filelist = None , items_to_process = filenames ,
260+ )
261+
262+ # Verify
263+ assert result == 0
264+ assert files_to_process == filenames
265+
196266 def test_single_file_and_list (self , tmp_path ):
197267 """Test giving it a single file by its relative path"""
198268 # Setup
@@ -216,18 +286,18 @@ def test_single_file_and_list(self, tmp_path):
216286
217287 # Run
218288 files_to_process , result = rimport .get_files_to_process (
219- file = filename , filelist = filelist
289+ file = filename , filelist = filelist , items_to_process = None ,
220290 )
221291
222292 # Verify
223293 assert result == 0
224294 assert files_to_process == [filename ] + filenames
225295
226- def test_single_or_list_required (self ):
227- """Test that either file or filelist is required"""
296+ def test_single_or_filelist_or_list_required (self ):
297+ """Test that at least one of file, filelist, items_to_process is required"""
228298 # Run
229299 files_to_process , result = rimport .get_files_to_process (
230- file = None , filelist = None
300+ file = None , filelist = None , items_to_process = None ,
231301 )
232302
233303 # Verify
0 commit comments