[apycotlib] upgrade to narval 4.1
authorDavid Douard <david.douard@logilab.fr>
Thu, 10 Jul 2014 16:00:26 +0200
changeset 1550 d77b516a8f00
parent 1549 46be4dfc1070
child 1553 ba466ae29ba8
[apycotlib] upgrade to narval 4.1 in which cwuri is not used any more and to follow the change in TestDataWriter API.
_apycotlib/narvalactions.py
_apycotlib/writer.py
debian/control
test/unittest_apycot.py
--- a/_apycotlib/narvalactions.py	Thu Jul 10 10:27:16 2014 +0200
+++ b/_apycotlib/narvalactions.py	Thu Jul 10 16:00:26 2014 +0200
@@ -5,7 +5,7 @@
         self.plan = plan
 
     def __enter__(self):
-        w  = writer.TestDataWriter(self.plan.cnxh, self.plan.plandata['cwuri'])
+        w  = writer.TestDataWriter(self.plan.cnxh, self.plan.plandata['eid'])
         test = atest.Test(self.plan.plandata, w)
         test.setup()
         self.test = test
--- a/_apycotlib/writer.py	Thu Jul 10 10:27:16 2014 +0200
+++ b/_apycotlib/writer.py	Thu Jul 10 16:00:26 2014 +0200
@@ -102,17 +102,15 @@
     a CubicWeb instance (using the apycot cube)
     """
 
-    def __init__(self, cnxh, target_url):
+    def __init__(self, cnxh, target_eid):
         self.cnxh = cnxh
         # eid of the execution entity
-        self._url = target_url
+        self.target_eid = target_eid
+        self._url = self.cnxh.instance_url + str(target_eid)
         self._log_file_eid = None
         self._logs = []
         self._logs_sent = 0
 
-    def target_eid(self):
-        return self._url.rsplit('/',1)[-1]
-
     def start(self):
         pass
 
@@ -199,7 +197,7 @@
     def make_check_writer(self):
         """Return a CheckDataWriter suitable to write checker log and result within this test"""
         self.refresh_log()
-        return CheckDataWriter(self.cnxh, self._url)
+        return CheckDataWriter(self.cnxh, self.target_eid)
 
     def link_to_revision(self, environment, vcsrepo):
         changeset = vcsrepo.changeset()
@@ -219,7 +217,7 @@
                             status=self._unicode(status))
         if archivedir:
             self.cnxh.debug('Archive the apycot temp directory')
-            archive = make_archive_name(self.cnxh.instance_id, self.target_eid())
+            archive = make_archive_name(self.cnxh.instance_id, self.target_eid)
             archivefpath = os.path.join(tempfile.gettempdir(), archive)
             tarball = tarfile.open(archivefpath, ARCHIVE_MODE)
             try:
--- a/debian/control	Thu Jul 10 10:27:16 2014 +0200
+++ b/debian/control	Thu Jul 10 16:00:26 2014 +0200
@@ -15,7 +15,7 @@
  cubicweb-common (>= 3.17.0),
  cubicweb-vcsfile (>= 1.12),
  cubicweb-file (>= 1.14.0),
- cubicweb-narval (>= 4.0.0),
+ cubicweb-narval (>= 4.1.0),
  python-pygments,
  ${misc:Depends},
  ${python:Depends},
@@ -32,7 +32,7 @@
 Package: narval-apycot
 Architecture: all
 Depends:
- narval-bot (>= 4.0.0),
+ narval-bot (>= 4.1.0),
  python-unittest2 | python (>= 2.7),
  python-lxml,
  mercurial (>= 2.2),
--- a/test/unittest_apycot.py	Thu Jul 10 10:27:16 2014 +0200
+++ b/test/unittest_apycot.py	Thu Jul 10 16:00:26 2014 +0200
@@ -32,7 +32,7 @@
         self.commit()
         with self.login('narval', password='narval0') as cu:
             cnxh = HTTPConnectionHandler('narval')
-            writer = TestDataWriter(cnxh, te.cwuri)
+            writer = TestDataWriter(cnxh, te.eid)
             writer.start()
             cwriter = writer.make_check_writer()
             cwriter.start(MockChecker(u'pylint', {}))