[test] compatibility with vcsfile 2 draft
authorDavid Douard <david.douard@logilab.fr>
Sat, 11 Oct 2014 17:35:51 +0200
changeset 1734 e3548d8d2868
parent 1733 46b0fec4df00
child 1735 ef4cbeb91ec6
[test] compatibility with vcsfile 2 use HGRCMixin in some tests
test/data/project.zip
test/data/project/__init__.py
test/data/project/__pkginfo__.py
test/data/project/setup.py
test/test_functional.py
Binary file test/data/project.zip has changed
--- a/test/data/project/__pkginfo__.py	Tue Dec 23 15:39:21 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-modname = distname = 'project'
-version = 0.0.1
-author = 'toto'
-author_email = 'toto@otot.com'
-web = 'www.toto.com'
-license = 'GPL v0.0'
-
--- a/test/data/project/setup.py	Tue Dec 23 15:39:21 2014 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-print 'hello'
--- a/test/test_functional.py	Tue Dec 23 15:39:21 2014 +0100
+++ b/test/test_functional.py	Sat Oct 11 17:35:51 2014 +0200
@@ -1,34 +1,29 @@
 import os
 import os.path as osp
-import subprocess
-import shutil
+from shutil import rmtree
 
+from logilab.common.shellutils import unzip
 from logilab.common.testlib import unittest_main
+
 import cubicweb.devtools
 import cubes.apycot.testutils as utils
+from cubes.apycot.recipes import full_script
+from cubes.vcsfile.testutils import HGRCMixin
 
-from cubes.apycot.recipes import full_script
-
-HERE = osp.abspath(osp.dirname(__file__))
+DATA = osp.join(osp.dirname(__file__), 'data')
+os.environ['HGRCPATH'] = os.devnull
 
 import narvalbot
-narvalbot._CW_SOURCES_FILE = osp.join(HERE, 'data', 'narval-cw-sources.ini')
+narvalbot._CW_SOURCES_FILE = osp.join(DATA, 'narval-cw-sources.ini')
 
-os.environ['HGRCPATH'] = os.devnull
 
-def setUpModule():
-    ppath = osp.join(HERE, 'data', 'project')
-    if osp.isdir(osp.join(ppath, '.hg')):
-        shutil.rmtree(osp.join(ppath, '.hg'))
-    subprocess.check_call(['hg', 'init', '-q', ppath])
-    subprocess.check_call(['hg', 'addremove', '-q', '-R', ppath])
-    subprocess.check_call(['hg', 'commit', '-q', '-R', ppath, '-m', 'ze rev', '-u', 'narval'])
-    subprocess.check_call(['hg', 'phase', '-p', '.', '-q', '-R', ppath])
+for repo in ('project', ):
+    repopath = osp.join(DATA, repo)
+    if osp.exists(repopath):
+        rmtree(repopath)
+    unzip(osp.join(DATA, '%s.zip') % repo, DATA)
 
-def tearDownModule():
-    shutil.rmtree(osp.join(HERE, 'data', 'project', '.hg'))
-
-class ApycotTC(utils.ApycotBaseTC):
+class ApycotTC(HGRCMixin, utils.ApycotBaseTC):
 
     def test_quick_recipe(self):
         with self.admin_access.client_cnx() as cnx:
@@ -53,6 +48,8 @@
             self.run_plan(te)
             exp = {u'pycoverage': u'error', u'pyunit': u'nodata'}
             try:
+                # do only check pylint tests where executed if pylint
+                # is available
                 from pylint import checkers as pycheckers
                 from pylint.lint import PyLinter
                 from pylint.__pkginfo__ import version as pylint_version