@@ -115,7 +115,7 @@ def test_set_input_lists(inputs, expected, user_filesystem):
115
115
base_dir .resolve () / expected_path for expected_path in expected
116
116
]
117
117
118
- cli_inputs = inputs + ["--mud" , "2.5" ]
118
+ cli_inputs = [ "applymud" ] + inputs + ["--mud" , "2.5" ]
119
119
actual_args = get_args (cli_inputs )
120
120
actual_args = set_input_lists (actual_args )
121
121
assert sorted (actual_args .input_paths ) == sorted (expected_paths )
@@ -161,7 +161,7 @@ def test_set_input_lists(inputs, expected, user_filesystem):
161
161
def test_set_input_files_bad (inputs , expected_error_msg , user_filesystem ):
162
162
base_dir = Path (user_filesystem )
163
163
os .chdir (base_dir )
164
- cli_inputs = inputs + ["--mud" , "2.5" ]
164
+ cli_inputs = [ "applymud" ] + inputs + ["--mud" , "2.5" ]
165
165
actual_args = get_args (cli_inputs )
166
166
with pytest .raises (FileNotFoundError , match = re .escape (expected_error_msg )):
167
167
actual_args = set_input_lists (actual_args )
@@ -179,7 +179,7 @@ def test_set_input_files_bad(inputs, expected_error_msg, user_filesystem):
179
179
def test_set_output_directory (inputs , expected , user_filesystem ):
180
180
os .chdir (user_filesystem )
181
181
expected_output_directory = Path (user_filesystem ) / expected [0 ]
182
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
182
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
183
183
actual_args = get_args (cli_inputs )
184
184
actual_args = set_output_directory (actual_args )
185
185
assert actual_args .output_directory == expected_output_directory
@@ -190,6 +190,7 @@ def test_set_output_directory(inputs, expected, user_filesystem):
190
190
def test_set_output_directory_bad (user_filesystem ):
191
191
os .chdir (user_filesystem )
192
192
cli_inputs = [
193
+ "applymud" ,
193
194
"data.xy" ,
194
195
"--mud" ,
195
196
"2.5" ,
@@ -235,7 +236,7 @@ def test_load_wavelength_from_config_file_with_home_conf_file(
235
236
mocker .patch ("pathlib.Path.home" , lambda _ : home_dir )
236
237
os .chdir (cwd )
237
238
238
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
239
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
239
240
actual_args = get_args (cli_inputs )
240
241
actual_args = load_wavelength_from_config_file (actual_args )
241
242
assert actual_args .wavelength == expected ["wavelength" ]
@@ -278,7 +279,7 @@ def test_load_wavelength_from_config_file_with_local_conf_file(
278
279
with open (cwd / "diffpyconfig.json" , "w" ) as f :
279
280
json .dump (local_config_data , f )
280
281
281
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
282
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
282
283
actual_args = get_args (cli_inputs )
283
284
actual_args = load_wavelength_from_config_file (actual_args )
284
285
assert actual_args .wavelength == expected ["wavelength" ]
@@ -321,7 +322,7 @@ def test_load_wavelength_from_config_file_without_conf_files(
321
322
confile = home_dir / "diffpyconfig.json"
322
323
os .remove (confile )
323
324
324
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
325
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
325
326
actual_args = get_args (cli_inputs )
326
327
actual_args = load_wavelength_from_config_file (actual_args )
327
328
assert actual_args .wavelength == expected ["wavelength" ]
@@ -380,7 +381,7 @@ def test_load_wavelength_from_config_file_without_conf_files(
380
381
],
381
382
)
382
383
def test_set_wavelength (inputs , expected ):
383
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
384
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
384
385
actual_args = get_args (cli_inputs )
385
386
actual_args = set_wavelength (actual_args )
386
387
assert actual_args .wavelength == expected ["wavelength" ]
@@ -419,7 +420,7 @@ def test_set_wavelength(inputs, expected):
419
420
],
420
421
)
421
422
def test_set_wavelength_bad (inputs , expected_error_msg ):
422
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
423
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
423
424
actual_args = get_args (cli_inputs )
424
425
with pytest .raises (ValueError , match = re .escape (expected_error_msg )):
425
426
actual_args = set_wavelength (actual_args )
@@ -435,14 +436,14 @@ def test_set_wavelength_bad(inputs, expected_error_msg):
435
436
],
436
437
)
437
438
def test_set_xtype (inputs , expected_xtype ):
438
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
439
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
439
440
actual_args = get_args (cli_inputs )
440
441
actual_args = set_xtype (actual_args )
441
442
assert actual_args .xtype == expected_xtype
442
443
443
444
444
445
def test_set_xtype_bad ():
445
- cli_inputs = ["data.xy" , "--mud" , "2.5" , "--xtype" , "invalid" ]
446
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" , "--xtype" , "invalid" ]
446
447
actual_args = get_args (cli_inputs )
447
448
with pytest .raises (
448
449
ValueError ,
@@ -474,7 +475,7 @@ def test_set_xtype_bad():
474
475
def test_set_mud (user_filesystem , inputs , expected_mud ):
475
476
cwd = Path (user_filesystem )
476
477
os .chdir (cwd )
477
- cli_inputs = ["data.xy" ] + inputs
478
+ cli_inputs = ["applymud" , " data.xy" ] + inputs
478
479
actual_args = get_args (cli_inputs )
479
480
actual_args = set_mud (actual_args )
480
481
assert actual_args .mud == pytest .approx (expected_mud , rel = 1e-4 , abs = 0.1 )
@@ -550,7 +551,7 @@ def test_set_mud_bad(user_filesystem, inputs, expected):
550
551
expected_error , expected_error_msg = expected
551
552
cwd = Path (user_filesystem )
552
553
os .chdir (cwd )
553
- cli_inputs = ["data.xy" ] + inputs
554
+ cli_inputs = ["applymud" , " data.xy" ] + inputs
554
555
actual_args = get_args (cli_inputs )
555
556
with pytest .raises (expected_error , match = re .escape (expected_error_msg )):
556
557
actual_args = set_mud (actual_args )
@@ -577,12 +578,12 @@ def test_set_mud_bad(user_filesystem, inputs, expected):
577
578
],
578
579
)
579
580
def test_load_user_metadata (inputs , expected ):
580
- expected_args = get_args (["data.xy" , "--mud" , "2.5" ])
581
+ expected_args = get_args (["applymud" , " data.xy" , "--mud" , "2.5" ])
581
582
for expected_pair in expected :
582
583
setattr (expected_args , expected_pair [0 ], expected_pair [1 ])
583
584
delattr (expected_args , "user_metadata" )
584
585
585
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
586
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
586
587
actual_args = get_args (cli_inputs )
587
588
actual_args = load_user_metadata (actual_args )
588
589
assert actual_args == expected_args
@@ -618,7 +619,7 @@ def test_load_user_metadata(inputs, expected):
618
619
],
619
620
)
620
621
def test_load_user_metadata_bad (inputs , expected_error_msg ):
621
- cli_inputs = ["data.xy" , "--mud" , "2.5" ] + inputs
622
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ] + inputs
622
623
actual_args = get_args (cli_inputs )
623
624
with pytest .raises (ValueError , match = re .escape (expected_error_msg )):
624
625
actual_args = load_user_metadata (actual_args )
@@ -681,6 +682,7 @@ def test_load_user_info(monkeypatch, inputs, expected, user_filesystem):
681
682
os .chdir (cwd )
682
683
683
684
cli_inputs = [
685
+ "applymud" ,
684
686
"data.xy" ,
685
687
"--mud" ,
686
688
"2.5" ,
@@ -705,7 +707,7 @@ def test_load_package_info(mocker):
705
707
"3.3.0" if package_name == "diffpy.utils" else "1.2.3"
706
708
),
707
709
)
708
- cli_inputs = ["data.xy" , "--mud" , "2.5" ]
710
+ cli_inputs = ["applymud" , " data.xy" , "--mud" , "2.5" ]
709
711
actual_args = get_args (cli_inputs )
710
712
actual_args = load_package_info (actual_args )
711
713
assert actual_args .package_info == {
@@ -731,6 +733,7 @@ def test_load_metadata(mocker, user_filesystem):
731
733
),
732
734
)
733
735
cli_inputs = [
736
+ "applymud" ,
734
737
"." ,
735
738
"--mud" ,
736
739
"2.5" ,
0 commit comments