On Sun, Mar 24, 2019 at 04:10:38PM +0200, Noa Osherovich wrote: > Add unittests for extended CQ control path: > - Creation and deletion of an extended CQ (good flow), with and > without a completion channel. > - Bad flow checks: Verify failure for illegal comp_vector / cqe number. > > Signed-off-by: Noa Osherovich <noaos@xxxxxxxxxxxx> > Reviewed-by: Maor Gottlieb <maorg@xxxxxxxxxxxx> > Reviewed-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > pyverbs/tests/cq.py | 81 ++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 80 insertions(+), 1 deletion(-) > > diff --git a/pyverbs/tests/cq.py b/pyverbs/tests/cq.py > index afe732e5e93c..4c1cea2b5296 100644 > +++ b/pyverbs/tests/cq.py > @@ -6,8 +6,8 @@ Test module for pyverbs' cq module. > import unittest > import random > > +from pyverbs.cq import CompChannel, CQ, CqInitAttrEx, CQEX > from pyverbs.pyverbs_error import PyverbsError > -from pyverbs.cq import CompChannel, CQ > import pyverbs.device as d > import pyverbs.enums as e > > @@ -124,7 +124,86 @@ class CCTest(unittest.TestCase): > cc.close() > > > +class CQEXTest(unittest.TestCase): > + """ > + Test various functionalities of the CQEX class. > + """ > + > + @staticmethod > + def test_create_cq_ex(): > + """ > + Test ibv_create_cq_ex() > + """ > + lst = d.get_device_list() > + for dev in lst: > + with d.Context(name=dev.name.decode()) as ctx: > + with CQEX(ctx, get_attrs_ex(ctx)): > + pass There is a way to use unittest so that it will setup a context before calling the test - avoiding all this repetition. You should make a patch to convert to that approach. Jason