49
49
"input_dir/binary.pkl" ,
50
50
],
51
51
),
52
- ( # list of files provided (we skip if encountering missing files)
53
- ["good_data.chi" , "good_data.xy" , "unreadable_file.txt" , "missing_file.txt" ],
54
- ["good_data.chi" , "good_data.xy" , "unreadable_file.txt" ],
55
- ),
56
- ( # list of files provided (with invalid files and files in different directories)
57
- ["input_dir/good_data.chi" , "good_data.chi" , "missing_file.txt" ],
58
- ["input_dir/good_data.chi" , "good_data.chi" ],
59
- ),
60
52
( # file_list.txt list of files provided
61
53
["input_dir/file_list.txt" ],
62
54
["good_data.chi" , "good_data.xy" , "good_data.txt" ],
@@ -77,22 +69,24 @@ def test_set_input_lists(inputs, expected, user_filesystem):
77
69
cli_inputs = ["2.5" ] + inputs
78
70
actual_args = get_args (cli_inputs )
79
71
actual_args = set_input_lists (actual_args )
80
- assert actual_args .input_directory == expected_paths
81
-
82
-
83
- # This test is for existing single input file or directory absolute path not in cwd
84
- # Here we are in user_filesystem/input_dir, testing for a file or directory in user_filesystem
85
- params_input_not_cwd = [
86
- (["good_data.chi" ], ["good_data.chi" ]),
87
- (["." ], ["good_data.chi" , "good_data.xy" , "good_data.txt" , "unreadable_file.txt" , "binary.pkl" ]),
88
- ]
72
+ assert list (actual_args .input_directory ).sort () == expected_paths .sort ()
89
73
90
74
91
75
# This test covers non-existing single input file or directory, in this case we raise an error with message
92
76
params_input_bad = [
93
- (["non_existing_file.xy" ], "Please specify at least one valid input file or directory." ),
94
- (["./input_dir/non_existing_file.xy" ], "Please specify at least one valid input file or directory." ),
95
- (["./non_existing_dir" ], "Please specify at least one valid input file or directory." ),
77
+ (
78
+ ["non_existing_file.xy" ],
79
+ "Cannot find non_existing_file.xy. Please specify valid input file(s) or directories." ,
80
+ ),
81
+ (
82
+ ["./input_dir/non_existing_file.xy" ],
83
+ "Cannot find ./input_dir/non_existing_file.xy. Please specify valid input file(s) or directories." ,
84
+ ),
85
+ (["./non_existing_dir" ], "Cannot find ./non_existing_dir. Please specify valid input file(s) or directories." ),
86
+ ( # list of files provided (with missing files)
87
+ ["good_data.chi" , "good_data.xy" , "unreadable_file.txt" , "missing_file.txt" ],
88
+ "Cannot find missing_file.txt. Please specify valid input file(s) or directories." ,
89
+ ),
96
90
]
97
91
98
92
@@ -102,7 +96,7 @@ def test_set_input_files_bad(inputs, msg, user_filesystem):
102
96
os .chdir (base_dir )
103
97
cli_inputs = ["2.5" ] + inputs
104
98
actual_args = get_args (cli_inputs )
105
- with pytest .raises (ValueError , match = msg [0 ]):
99
+ with pytest .raises (FileNotFoundError , match = msg [0 ]):
106
100
actual_args = set_input_lists (actual_args )
107
101
108
102
0 commit comments