diff --git a/doc/development/TESTING.md b/doc/development/TESTING.md index e33008cdf..b28be2ffd 100644 --- a/doc/development/TESTING.md +++ b/doc/development/TESTING.md @@ -72,27 +72,29 @@ import shutil from risu import risu # To create your own test, update NAME with plugin name and copy this file to test_$NAME.py -NAME = 'httpd_bug_1406417' +NAME = "httpd_bug_1406417" -testplugins = os.path.join(risu.risudir, 'plugins', 'test') -plugins = os.path.join(risu.risudir, 'plugins') -folder = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'setup') +testplugins = os.path.join(risu.risudir, "plugins", "test") +plugins = os.path.join(risu.risudir, "plugins") +folder = os.path.join(os.path.abspath(os.path.dirname(__file__)), "setup") uttest = risu.findplugins(folders=[folder], include=[NAME])[0] us = os.path.basename(uttest) citplugs = risu.findplugins(folders=[plugins], include=[us]) # Setup commands and expected return codes -rcs = {"pass": risu.RC_OKAY, - "fail": risu.RC_FAILED, - "skipped": risu.RC_SKIPPED, - "info": risu.RC_INFO} +rcs = { + "pass": risu.RC_OKAY, + "fail": risu.RC_FAILED, + "skipped": risu.RC_SKIPPED, + "info": risu.RC_INFO, +} -def runtest(testtype='False'): +def runtest(testtype="False"): # testtype will be 'pass', 'fail', 'skipped' # We're iterating against the different UT tests defined in UT-tests folder - tmpdir = tempfile.mkdtemp(prefix='risu-tmp') + tmpdir = tempfile.mkdtemp(prefix="risu-tmp") # Setup test for 'testtype' subprocess.call([uttest, uttest, testtype, tmpdir]) @@ -101,7 +103,7 @@ def runtest(testtype='False'): res = risu.dorisu(path=tmpdir, plugins=citplugs) # Get Return code - rc = res[0]['result']['rc'] + rc = res[0]["result"]["rc"] # Remove tmp folder shutil.rmtree(tmpdir) @@ -113,17 +115,17 @@ def runtest(testtype='False'): class RisuTest(TestCase): def test_pass(self): # testtype will be 'pass', 'fail', 'skipped' - testtype = 'pass' - assert runtest(testtype='fail') == rcs[testtype] + testtype = "pass" + assert runtest(testtype="fail") == rcs[testtype] def test_fail(self): # testtype will be 'pass', 'fail', 'skipped' - testtype = 'fail' + testtype = "fail" assert runtest(testtype=testtype) == rcs[testtype] def test_skip(self): # testtype will be 'pass', 'fail', 'skipped' - testtype = 'skipped' + testtype = "skipped" assert runtest(testtype=testtype) == rcs[testtype] ``` diff --git a/doc/development/i18n.md b/doc/development/i18n.md index 6510d955a..2a93d136c 100644 --- a/doc/development/i18n.md +++ b/doc/development/i18n.md @@ -19,9 +19,10 @@ As described in plugins documentation, Risu can make use of translated strings. ```py # Import the _() function import gettext - localedir = os.environ['TEXTDOMAINDIR'] + + localedir = os.environ["TEXTDOMAINDIR"] # This will use system defined LANGUAGE - trad = gettext.translation('risu', localedir, fallback=True) + trad = gettext.translation("risu", localedir, fallback=True) try: _ = trad.ugettext diff --git a/doc/development/magui-plugin-development.md b/doc/development/magui-plugin-development.md index eec6d56cc..868d853e5 100644 --- a/doc/development/magui-plugin-development.md +++ b/doc/development/magui-plugin-development.md @@ -32,18 +32,20 @@ Magui plugins should conform to the following standards: returncode = risu.RC_OKAY - message = '' + message = "" for ourdata in data: # 'err' in this case should be always equal to the md5sum of the file so that we can report the problem err = [] - for sosreport in ourdata['sosreport']: - err.append(ourdata['sosreport'][sosreport]['err']) + for sosreport in ourdata["sosreport"]: + err.append(ourdata["sosreport"][sosreport]["err"]) if len(sorted(set(err))) != 1: - message = _("Pipeline.yaml contents differ across sosreports, please do check that the contents are the same and shared across the environment to ensure proper behavior.") + message = _( + "Pipeline.yaml contents differ across sosreports, please do check that the contents are the same and shared across the environment to ensure proper behavior." + ) returncode = risu.RC_FAILED - out = '' + out = "" err = message return returncode, out, err ```