[test] make hook tests pass with cubicweb 3.22 (related to #10624160)

authorDavid Douard <david.douard@logilab.fr>
changeset00f668018eec
branchdefault
phasepublic
hiddenno
parent revision#6cbf0b3a8c62 [test] ensure cubicweb.devtools.testlib is imported first
child revision#8381a7653419 [entities] cw 3.22: Binary is now a BytesIO (closes #10624160), #b89f1d873fc5 [entities] cw 3.22: Binary is now a BytesIO (closes #10624160)
files modified by this revision
test/unittest_hooks.py
# HG changeset patch
# User David Douard <david.douard@logilab.fr>
# Date 1455036173 -3600
# Tue Feb 09 17:42:53 2016 +0100
# Node ID 00f668018eec620834c0ea76e1bebdf3a641bcda
# Parent 6cbf0b3a8c62e1358ea398a66de046d2777a56d3
[test] make hook tests pass with cubicweb 3.22 (related to #10624160)

diff --git a/test/unittest_hooks.py b/test/unittest_hooks.py
@@ -29,10 +29,13 @@
1                  self.cw_set(pid=1)
2 
3              with self.admin_access.client_cnx() as cnx:
4                  subprocess = self.pyprocess(cnx, 'print "toto"')
5                  self.fire_transition(subprocess, 'start')
6 +                cnx.commit()
7 +            with self.admin_access.client_cnx() as cnx:
8 +                subprocess = cnx.entity_from_eid(subprocess.eid)
9                  self.assertEqual(1, subprocess.pid)
10 
11      def test_kill(self):
12          with saved_vars(Subprocess):
13              @monkeypatch(Subprocess)
@@ -45,10 +48,13 @@
14 
15              with self.admin_access.client_cnx() as cnx:
16                  subprocess = self.pyprocess(cnx, 'print "toto"')
17                  self.fire_transition(subprocess, 'start')
18                  self.fire_transition(subprocess, 'kill')
19 +                cnx.commit()
20 +            with self.admin_access.client_cnx() as cnx:
21 +                subprocess = cnx.entity_from_eid(subprocess.eid)
22                  self.assertEqual(0, subprocess.pid)
23 
24 
25 
26  if __name__ == '__main__':