def test_no_files_in_directory(self): if os.path.exists('./tests/data/dcs_world/dynamic_folder_creation'): shutil.rmtree('./tests/data/dcs_world/dynamic_folder_creation') os.mkdir('./tests/data/dcs_world/dynamic_folder_creation') os.mkdir('./tests/data/dcs_world/dynamic_folder_creation/Config') os.mkdir('./tests/data/dcs_world/dynamic_folder_creation/Config/Input') with self.assertRaises(Exception) as context: dcs.DCSWorldParser( './tests/data/dcs_world/dynamic_folder_creation') self.assertTrue('DCS: No profiles exist in Input directory!' in str( context.exception))
def load_dcs_directory(self): try: self.dcs_profiles_list.clear() self.dcs_parser_instance = dcs.DCSWorldParser( self.dcs_directory, remove_easy_modes=self.dcs_easy_mode_checkbox.isChecked()) self.print_to_info('Successfully loaded DCS profiles') self.enable_profile_load_button(self.dcs_directory_select_button) self.dcs_selected_directory_label.setText('in {}'.format( self.dcs_directory)) self.export_button.setEnabled(1) except Exception: self.disable_profile_load_button(self.dcs_directory_select_button) self.export_button.setEnabled(0) self.dcs_selected_directory_label.setText('') raise else: self.dcs_profiles_list.clear() self.dcs_profiles_list.addItems( self.dcs_parser_instance.get_validated_profiles())
def setUp(self): self.dcs_instance = dcs.DCSWorldParser( './tests/data/dcs_world/valid_dcs_world_directory')
def test_no_joystick_directory(self): with self.assertRaises(Exception) as context: dcs.DCSWorldParser( './tests/data/dcs_world/invalid_dcs_world_no_input') self.assertTrue( 'DCS: No input directory found' in str(context.exception))
def test_no_config_path(self): with self.assertRaises(Exception) as context: dcs.DCSWorldParser( './tests/data/dcs_world/invalid_dcs_world_no_config') self.assertTrue('DCS: No Config Folder found in DCS Folder' in str( context.exception))