diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-28 14:37:47 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-09-28 14:37:47 -0400 |
commit | 253ea79f511051ab8a1501a161d1d8c04b837919 (patch) | |
tree | c00f2d1a3bb39eb051feb616dfd589065fd0aeb8 /testsuite | |
parent | 628132178f4f0c7f502480d362b6e9a664f47008 (diff) | |
download | bcfg2-253ea79f511051ab8a1501a161d1d8c04b837919.tar.gz bcfg2-253ea79f511051ab8a1501a161d1d8c04b837919.tar.bz2 bcfg2-253ea79f511051ab8a1501a161d1d8c04b837919.zip |
fixed contingent pylint code checks
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/Testsrc/test_code_checks.py | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/testsuite/Testsrc/test_code_checks.py b/testsuite/Testsrc/test_code_checks.py index 951454ffd..8a32903c1 100644 --- a/testsuite/Testsrc/test_code_checks.py +++ b/testsuite/Testsrc/test_code_checks.py @@ -39,11 +39,22 @@ sbin_error_checks = { # perform checks on the listed files only if the module listed in the # keys can be imported -contingent_checks = dict( - django={"lib/Bcfg2/Server": ["Reports", "SchemaUpdater", "models.py"]}, - pyinotify={"lib/Bcfg2/Server/FileMonitor": ["Inotify.py"]}, - yum={"lib/Bcfg2/Client/Tools": ["YUM*"]} - ) +contingent_checks = { + ("django",): {"lib/Bcfg2/Server": ["Reports", + "SchemaUpdater", + "models.py"]}, + ("pyinotify",): {"lib/Bcfg2/Server/FileMonitor": ["Inotify.py"]}, + ("yum",): {"lib/Bcfg2/Client/Tools": ["YUM*"]}, + ("genshi",): {"lib/Bcfg2/Server/Plugins/Cfg": ["CfgGenshiGenerator.py"]}, + ("Cheetah",): {"lib/Bcfg2/Server/Plugins/Cfg": ["CfgCheetahGenerator.py"]}, + ("M2Crypto",): {"lib/Bcfg2": ["Encryption.py"], + "lib/Bcfg2/Server/Plugins/Cfg": + ["CfgEncryptedGenerator.py"]}, + ("M2Crypto", "genshi"): {"lib/Bcfg2/Server/Plugins/Cfg": + ["CfgEncryptedGenshiGenerator.py"]}, + ("M2Crypto", "Cheetah"): {"lib/Bcfg2/Server/Plugins/Cfg": + ["CfgEncryptedCheetahGenerator.py"]}, + } # perform only error checking on the listed files error_checks = { @@ -161,9 +172,10 @@ class TestPylint(Bcfg2TestCase): @skipUnless(HAS_PYLINT, "pylint not found, skipping") def test_contingent_full(self): blacklist = set(expand_path_dict(error_checks) + self.blacklist) - for (mod, filedict) in contingent_checks.items(): + for (mods, filedict) in contingent_checks.items(): try: - __import__(mod) + for mod in mods: + __import__(mod) except ImportError: continue self._pylint_full(blacklist_filter(expand_path_dict(filedict), @@ -203,9 +215,10 @@ class TestPylint(Bcfg2TestCase): @skipUnless(HAS_PYLINT, "pylint not found, skipping") def test_contingent_errors(self): whitelist = expand_path_dict(error_checks) - for (mod, filedict) in contingent_checks.items(): + for (mods, filedict) in contingent_checks.items(): try: - __import__(mod) + for mod in mods: + __import__(mod) except ImportError: continue flist = \ @@ -218,7 +231,11 @@ class TestPylint(Bcfg2TestCase): @skipIf(not os.path.exists(rcfile), "%s does not exist" % rcfile) @skipUnless(HAS_PYLINT, "pylint not found, skipping") def test_lib_errors(self): - return self._pylint_errors(expand_path_dict(error_checks)) + blacklist = [] + for filedict in contingent_checks.values(): + blacklist += expand_path_dict(filedict) + filelist = blacklist_filter(expand_path_dict(error_checks), blacklist) + return self._pylint_errors(filelist) def _pylint_errors(self, paths, extra_args=None): """ test all files for fatals and errors """ |