def test_browse_path_cancel(self): canceled_path = '' print('A path browser window will open, to successfully run this test ' 'press cancel or close the window!!!\n') #raw_input('Press "Enter" to continue...') function_path = gui.browse_dir_dialog() self.assertEqual(canceled_path, function_path)
def set_sketch_path(): """ Opens the directory browser to select a file. Saves this directory into ServerCompilerSettings and if the directory is different to that stored already it triggers the new data to be saved into the settings file. """ new_directory = gui.browse_dir_dialog() if new_directory != '': ServerCompilerSettings().sketch_dir = new_directory return get_sketch_path()
def test_browse_path(self, mock_path_select): test_path = os.path.join(os.getcwd(), 'test_path') mock_path_select.return_value = test_path new_path = gui.browse_dir_dialog() self.assertEqual(new_path, test_path)