[test] reload quick recipe on startup
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 16 Jan 2013 15:00:07 +0100
changeset 1420 788f69fcc2e2
parent 1419 04b8e8af2e66
child 1421 00b78e701b79
[test] reload quick recipe on startup
recipes.py
test/utils.py
--- a/recipes.py	Fri Apr 25 15:56:11 2014 +0200
+++ b/recipes.py	Wed Jan 16 15:00:07 2013 +0100
@@ -1,4 +1,5 @@
-#
+"""functions to create defaut apycot recipes"""
+
 quick_script = u'''
 from apycotlib import narvalactions as na
 # `plan`
@@ -8,8 +9,8 @@
     checker, status = test.run_checker('pyunit')
 '''
 def create_quick_recipe(session):
-    recipe = session.create_entity('Recipe', name=u'apycot.recipe.quick',
-                                   script=quick_script)
+    return session.create_entity('Recipe', name=u'apycot.recipe.quick',
+                                 script=quick_script)
 
 full_script = u'''
 from apycotlib import narvalactions as na
@@ -22,6 +23,5 @@
     checker, status = test.run_checker('pylint')
 '''
 def create_full_recipe(session):
-    recipe = session.create_entity('Recipe', name=u'apycot.recipe.full',
-                                   script=full_script)
-    return recipe
+    return session.create_entity('Recipe', name=u'apycot.recipe.full',
+                                 script=full_script)
--- a/test/utils.py	Fri Apr 25 15:56:11 2014 +0200
+++ b/test/utils.py	Wed Jan 16 15:00:07 2013 +0100
@@ -6,7 +6,8 @@
 
 from cubicweb.devtools.testlib import CubicWebTC
 
-from cubes.apycot import entities
+from cubes.narval.testutils import NarvalBaseTC
+from cubes.apycot.recipes import quick_script
 
 from apycotlib.writer import CheckDataWriter, BaseDataWriter
 
@@ -127,7 +128,6 @@
     def commit(self):
         pass
 
-from cubes.narval.testutils import NarvalBaseTC
 
 class ApycotBaseTC(NarvalBaseTC):
 
@@ -148,6 +148,8 @@
                                      'python_test_coverage_treshold=70\n',
                                      check_environment=u'NO_SETUPTOOLS=1\nDISPLAY=:1.0')
         self.recipe = req.execute('Recipe X WHERE X name "apycot.recipe.quick"').get_entity(0, 0)
+        # reset recipe content
+        self.recipe.set_attributes(script=quick_script)
         self.lgc = self.add_test_config(u'lgc', env=self.lgce, group=self.pyp, use_recipe=self.recipe)
 
         self.repo.threaded_task = lambda func: func() # XXX move to cw