diff options
author | Arif Ali <arif.ali@canonical.com> | 2024-01-15 18:51:04 -0800 |
---|---|---|
committer | Jake Hunsaker <jacob.r.hunsaker@gmail.com> | 2024-04-12 11:50:48 -0400 |
commit | 93bcf51257ec4ce2b97c942e51e56546ce8cd0cd (patch) | |
tree | db1e835f5de49918553281726d86f4660731313e /plugins_overview.py | |
parent | 4069af4bca5d20662389200f0d426d2d31f054e8 (diff) | |
download | sos-93bcf51257ec4ce2b97c942e51e56546ce8cd0cd.tar.gz |
[testing] Add most testing via tox.ini
Consolidate testing, so that things can be run from CLI, CI and
various other means in a consistent way by using tox.
* Updated all the flake8 tests in the tests folder.
* Added pylint as a neutral test so that we can work on this in stages
and have some collaboration on what we test and don't
* The tox tests for unit, stageone, stagetwo testing makes is easier
for users to know how to run tests, and not have to do things
manually
* Using tox for CI doesn't make sense, as that will create virtual
envs and will disregard system/snap based python modules so may not
work
Signed-off-by: Arif Ali <arif.ali@canonical.com>
Diffstat (limited to 'plugins_overview.py')
-rw-r--r-- | plugins_overview.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins_overview.py b/plugins_overview.py index d847548c..fcd0d9d6 100644 --- a/plugins_overview.py +++ b/plugins_overview.py @@ -44,9 +44,9 @@ def add_valid_item(dest, item): # method to find in `plugcontent` all items of given method (a_c_s/a_c_o/..) # split by comma; add each valid item to the `dest` list -def add_all_items(method, dest, wrapopen='\(', wrapclose='\)'): +def add_all_items(method, dest, wrapopen=r'\(', wrapclose=r'\)'): regexp = "%s%s(.*?)%s" % (method, wrapopen, wrapclose) - for match in re.findall(regexp, plugcontent, flags=re.MULTILINE|re.DOTALL): + for match in re.findall(regexp, plugcontent, flags=re.MULTILINE | re.DOTALL): # tuple of distros ended by either (class|from|import) if isinstance(match, tuple): for item in list(match): @@ -89,7 +89,8 @@ for plugfile in sorted(os.listdir(PLUGDIR)): 'journals': [], 'env': [], } - plugcontent = open(os.path.join(PLUGDIR, plugfile)).read().replace('\n', '') + plugcontent = open( + os.path.join(PLUGDIR, plugfile)).read().replace('\n', '') add_all_items( "from sos.report.plugins import ", plugs_data[plugname]['distros'], @@ -112,7 +113,8 @@ if (len(sys.argv) > 1) and (sys.argv[1] == "csv"): "service_status;journals;env_vars") for plugname in plugs_data.keys(): plugin = plugs_data[plugname] - # determine max number of lines - usually "max(len(copyspec),len(commands))" + # determine max number of lines - usually + # "max(len(copyspec),len(commands))" # ignore 'sourcecode' key as it maxline = 1 plugkeys = list(plugin.keys()) |