def test_with_empty_args(): """ User passes no args, should produce a usage statement and then raise SystemExit. Usage statement will appear """ parser = create_parser() with pytest.raises(SystemExit): parser.parse_args()
def pipeline_wd(self, tmpdir_factory): wd = tmpdir_factory.mktemp("pdbechem_test") parser = create_parser() args = parser.parse_args(["-o", str(wd), test_cut_down_components_cif]) m = PDBeChemManager() m.run(args.components_cif, args.output_dir) return args.output_dir
def pipeline_wd(self, tmpdir_factory): wd = tmpdir_factory.mktemp('pdbechem_test') parser = create_parser() args = parser.parse_args(['-o', str(wd), test_cut_down_components_cif]) check_args(args) m = PDBeChemManager() m.run_pipeline(args) return str(wd)
def test_with_problematic_cif_7om(tmpdir): """ 7OM caused problems because it lacks an inchikey and this used to cause a crash """ cif_file = cif_filename('7OM') test_output_dir = tmpdir.mkdir('test_process_components_cif_70M') parser = create_parser() args = parser.parse_args([cif_file, '-o', str(test_output_dir)]) m = PDBeChemManager() m.run_pipeline(args) assert os.path.isdir( test_output_dir ), f'output directory {str(test_output_dir)} must be created'
def test_input_file_that_cannot_exist_raises_system_exit(): parser = create_parser() args = parser.parse_args( ['-o foo', '/////impossible_to_open_file', '--debug']) with pytest.raises(SystemExit): check_args(args)
def test_input_file_that_cannot_exist_raises_system_exit(): parser = create_parser() with pytest.raises(SystemExit): parser.parse_args( ["-o foo", "/////impossible_to_open_file", "--debug"])