def setUp(self): """Overridden method. Runs before each test. Makes instance of ToolboxUI class. """ # # Set logging level to Error to silence "Logging level: All messages" print logging.disable(level=logging.ERROR) # Disable logging self.toolbox = ToolboxUI() self.toolbox.create_project("UnitTest Project", "") logging.disable(level=logging.NOTSET) # Enable logging
def setUp(self): """Overridden method. Runs before each test. Makes instance of TreeViewForm class. """ # # Set logging level to Error to silence "Logging level: All messages" print logging.disable(level=logging.ERROR) # Disable logging toolbox = ToolboxUI() self.tool_template_widget = ToolTemplateWidget(toolbox) logging.disable(level=logging.NOTSET) # Enable logging
def setUp(self): """Overridden method. Runs before each test. Makes an instance of ToolboxUI class. We want the ToolboxUI to start with the default settings and without a project so we need to mock CONFIGURATION_FILE to prevent loading user's own configs from settings.conf. """ with mock.patch("ui_main.CONFIGURATION_FILE") as mocked_file_path, \ mock.patch("os.path.split") as mock_split, \ mock.patch("configuration.create_dir") as mock_create_dir: # # Set logging level to Error to silence "Logging level: All messages" print logging.disable(level=logging.ERROR) # Disable logging self.mw = ToolboxUI() logging.disable(level=logging.NOTSET) # Enable logging
def setUp(self): """Runs before each test. Makes an instance of ToolboxUI class. We want the ToolboxUI to start with the default settings and without a project so we need to mock CONFIGURATION_FILE to prevent loading user's own configs from settings.conf. """ with mock.patch("ui_main.ToolboxUI.save_project") as mock_save_project, \ mock.patch("project.create_dir") as mock_create_dir, \ mock.patch("ui_main.CONFIGURATION_FILE") as mock_confs, \ mock.patch("os.path.split") as mock_split, \ mock.patch("configuration.create_dir") as mock_create_dir2: # logging.disable(level=logging.ERROR) # Disable logging self.toolbox = ToolboxUI() self.toolbox.create_project("UnitTest Project", "")
def main(argv): """Launch application. Args: argv (list): Command line arguments """ logging.basicConfig(stream=sys.stderr, level=logging.DEBUG, format='%(asctime)s %(levelname)s: %(message)s', datefmt='%Y-%m-%d %H:%M:%S') if not pyside2_version_check(): return 0 if not spinedatabase_api_version_check(): return 0 # QApplication.setAttribute(Qt.AA_DisableHighDpiScaling) app = QApplication(argv) window = ToolboxUI() window.show() # Enter main event loop and wait until exit() is called return_code = app.exec_() return return_code