@@ -849,23 +849,29 @@ def test_load_metadata(mocker, user_filesystem, inputs, expected):
849849 assert actual_metadata == expected_metadata
850850
851851
852- def test_preprocess_args_bad (user_filesystem ):
852+ def test_preprocess_args_bad (user_filesystem , monkeypatch ):
853853 # Case: user tries to run absorption correction, but the output
854- # filenames already for *-mud-corrected.chi and *_cve .chi exists.
854+ # filenames already for *-mud-corrected.chi and *-cve .chi exists.
855855 # expected: preprocess_args catches this early and raises an Error
856+ cwd = Path (user_filesystem )
857+ home_dir = cwd / "home_dir"
858+ # set cwd so program can find diffpyconfig.json
859+ monkeypatch .setattr ("pathlib.Path.home" , lambda _ : home_dir )
856860 input_data_file = str (user_filesystem / "good_data.chi" )
857861 existing_corrected_file = str (
858862 user_filesystem / "output_dir" / "good_data-mud-corrected.chi"
859863 )
860864 existing_corrected_cve_file = str (
861- user_filesystem / "output_dir" / "good_data_cve.chi"
862- )
863- cli_inputs = (
864- ["mud" ]
865- + [input_data_file ]
866- + ["2.5" , "-w" , "Mo" , "-o" , str (user_filesystem / "output_dir" )]
867- + ["-c" ] # -c flag saves the cve file
865+ user_filesystem / "output_dir" / "good_data-cve.chi"
868866 )
867+ cli_inputs = [
868+ "mud" ,
869+ input_data_file ,
870+ "2.5" ,
871+ "-o" ,
872+ str (user_filesystem / "output_dir" ),
873+ "-c" , # -c flag saves the cve file
874+ ]
869875 args = get_args_cli (cli_inputs )
870876 args = set_input_lists (args )
871877 msg = (
0 commit comments