<div dir="ltr">Adding devel@ovirt, the proper mailing list<br>
</div><span>
</span><br><div class="gmail_quote"><div dir="ltr">בתאריך יום ו׳, 24 בנוב׳ 2017, 7:42, מאת Germano Veit Michel <<a href="mailto:germano@redhat.com">germano@redhat.com</a>>:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Hi,<br><br></div>I'm trying to write a test for a hook. The test will fail if the hook does "import hooking", which seems to be the norm for vdsm hooks.</div><div><br></div><div>[vdsm_hooks]$ grep -rn "import hooking" | wc -l<br>55<br></div><div><br></div><div></div><div></div><div>Not sure if I'm doing something wrong, but it looks like I would need vdsm installed on my development machine in order for this import to work.<br></div><div><br></div><div>======================================================================<br>ERROR: test suite for <class 'virttests.boot_hostdev_test.BootHostdevHookTests'><br>----------------------------------------------------------------------<br>Traceback (most recent call last):<br> File "/usr/lib/python2.7/site-packages/nose/suite.py", line 209, in run<br> self.setUp()<br> File "/usr/lib/python2.7/site-packages/nose/suite.py", line 292, in setUp<br> self.setupContext(ancestor)<br> File "/usr/lib/python2.7/site-packages/nose/suite.py", line 315, in setupContext<br> try_run(context, names)<br> File "/usr/lib/python2.7/site-packages/nose/util.py", line 471, in try_run<br> return func()<br> File "/home/gveitmic/Source/upstream/vdsm/tests/virttests/boot_hostdev_test.py", line 127, in setUpClass<br> import before_vm_start as boot_hostdev_hook<br> File "../vdsm_hooks/boot_hostdev/before_vm_start.py", line 24, in <module><br> import hooking<br>ImportError: No module named hooking<br><br clear="all"></div><div><div><div>I can make it go away by using this in my hook:</div><br>from vdsm.hook import hooking</div><div><br></div><div>Then the test succeeds fine. But then I see all hooks use "import hooking" instead of "from vdsm.hook import hooking".</div><div><br></div><div>[vdsm_hooks]$ grep -rn "from vdsm.hook import hooking" | wc -l<br>0</div><div><br></div><div>Am I doing something wrong? Can someone put a light here? What is the correct way to do this import?</div><div><br></div><div>Thanks,<div>Germano<br></div></div></div></div>
</blockquote></div>