[recipes] full: do not execute the pylint checker if pylint is unavailable
authorDavid Douard <david.douard@logilab.fr>
Wed, 07 Aug 2013 17:16:23 +0200
changeset 1442 b4d88164cf62
parent 1441 9aef65bee67c
child 1443 9d7e65b017f0
[recipes] full: do not execute the pylint checker if pylint is unavailable also remove the pycoverage checker from this recipe since it's been not working for a while now.
_apycotlib/__init__.py
recipes.py
--- a/_apycotlib/__init__.py	Tue Aug 06 09:55:53 2013 +0200
+++ b/_apycotlib/__init__.py	Wed Aug 07 17:16:23 2013 +0200
@@ -47,6 +47,13 @@
     except KeyError:
         raise ConfigError('No object %r in category %r' % (name, category))
 
+def registered(category, id):
+    try:
+        REGISTRY[category][id]
+        return True
+    except:
+        return False
+
 # apycot standard exception ####################################################
 
 class ConfigError(Exception):
@@ -162,7 +169,6 @@
             else:
                 raise Exception('Unknow option type %s for %s' % (opttype, optname))
 
-
 # base class for external commands handling ####################################
 
 class OutputParser(ApycotObject):
--- a/recipes.py	Tue Aug 06 09:55:53 2013 +0200
+++ b/recipes.py	Wed Aug 07 17:16:23 2013 +0200
@@ -14,15 +14,15 @@
                                  script=quick_script)
 
 full_script = u'''
-from apycotlib import narvalactions as na
+from apycotlib import registered, narvalactions as na
 from apycotlib.checkers import python # trigger registration
 # `plan`
 
 with na.apycot_environment(plan) as test:
     na.install_environment(test)
-    checker, status = test.run_checker('pyunit', pycoverage=True)
-    checker, status = test.run_checker('pycoverage', coverage_data=checker.coverage_data)
-    checker, status = test.run_checker('pylint')
+    checker, status = test.run_checker('pyunit')
+    if registered('checker', 'pylint'): # pylint may not be available
+        checker, status = test.run_checker('pylint')
 '''
 def create_full_recipe(session):
     return session.create_entity('Recipe', name=u'apycot.recipe.full',