def test_browse_file_cancel(self): canceled_file = '' print('A file browser window will open, to successfully run this test ' 'press cancel or close the window!!!\n') #raw_input('Press "Enter" to continue...') function_file = gui.browse_file_dialog() self.assertEqual(canceled_file, function_file)
def set_compiler_path(): """ Opens the file browser to select a file. Saves this file path into ServerCompilerSettings and if the file path is different to that stored already it triggers the new data to be saved into the settings file. """ new_path = gui.browse_file_dialog() if new_path != '': ServerCompilerSettings().compiler_dir = new_path return get_compiler_path()
def test_browse_file(self, mock_file_select): test_file = os.path.join(os.getcwd(), 'test_file') mock_file_select.return_value = test_file new_file = gui.browse_file_dialog() self.assertEqual(new_file, test_file)