From 30ca90b95c0ad6506dd64dc99e6e3324bc3fcb1d Mon Sep 17 00:00:00 2001 From: Abdullah Khalid Date: Sat, 14 Oct 2023 18:55:31 -0700 Subject: [PATCH] Add functionality to save and load command-line args. --- spyder_unittest/unittestplugin.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/spyder_unittest/unittestplugin.py b/spyder_unittest/unittestplugin.py index 236dce3..68b1118 100644 --- a/spyder_unittest/unittestplugin.py +++ b/spyder_unittest/unittestplugin.py @@ -49,11 +49,13 @@ class UnitTestPlugin(SpyderDockablePlugin): {'framework': '', 'wdir': '', 'coverage': False, + 'args': [], 'abbrev_test_names': False}), ('shortcuts', {'unittest/Run tests': 'Alt+Shift+F11'})] - CONF_NAMEMAP = {CONF_SECTION: [(CONF_SECTION, - ['framework', 'wdir', 'coverage'])]} + CONF_NAMEMAP = {CONF_SECTION: + [(CONF_SECTION, + ['framework', 'wdir', 'coverage', 'args'])]} CONF_FILE = True CONF_VERSION = '0.2.0' CONF_WIDGET_CLASS = UnitTestConfigPage @@ -316,7 +318,8 @@ def load_config(self): new_config = Config( framework=project.get_option('framework', self.CONF_SECTION), wdir=project.get_option('wdir', self.CONF_SECTION), - coverage=project.get_option('coverage', self.CONF_SECTION)) + coverage=project.get_option('coverage', self.CONF_SECTION), + args=project.get_option('args', self.CONF_SECTION)) if not widget.config_is_valid(new_config): new_config = None widget.set_config_without_emit(new_config) @@ -337,6 +340,7 @@ def save_config(self, test_config): self.CONF_SECTION) project.set_option('wdir', test_config.wdir, self.CONF_SECTION) project.set_option('coverage', test_config.coverage, self.CONF_SECTION) + project.set_option('args', test_config.args, self.CONF_SECTION) def goto_in_editor(self, filename, lineno): """