def test_help_message(dials_data, capsys): """Test that we get a help message when improper input is provided.""" data_dir = dials_data("centroid_test_data") # We'll need an integrated reflection table and an experiment list. reflections_file = data_dir.join("integrated.pickle").strpath experiments_file = data_dir.join("experiments.json").strpath for arguments in ( None, [reflections_file], [experiments_file], [experiments_file, reflections_file, "anvil.normal=0,0,0"], ): with pytest.raises(SystemExit): run(arguments) assert ("Usage: dials.anvil_correction [options] integrated.expt " "integrated.refl" in capsys.readouterr().err)
def test_command_line(dials_data, tmpdir): """Test that the program runs correctly.""" data_dir = dials_data("centroid_test_data") # We'll need an integrated reflection table and an experiment list. reflections_file = data_dir.join("integrated.pickle").strpath experiments_file = data_dir.join("experiments.json").strpath with tmpdir.as_cwd(): run([experiments_file, reflections_file]) output = tmpdir.join("corrected.refl") assert output.check(file=True) logfile = tmpdir.join("dials.anvil_correction.log").read() assert "Correcting integrated reflection intensities" in logfile assert "Writing the reflection table" in logfile