Change in vdsm[master]: virt: common handling of exceptions

nsoffer at redhat.com nsoffer at redhat.com
Thu Mar 17 14:53:39 UTC 2016


Nir Soffer has posted comments on this change.

Change subject: virt: common handling of exceptions
......................................................................


Patch Set 8:

(3 comments)

https://gerrit.ovirt.org/#/c/54664/8/tests/api_response_test.py
File tests/api_response_test.py:

Line 24: 
Line 25: from testlib import VdsmTestCase as TestCaseBase
Line 26: 
Line 27: 
Line 28: class ResponseTests(TestCaseBase):
Can you name the class TestResponse?

This name is automatically detected by py.test, even if you don't subclass from VdsmTestCase.

We can do these changes later, but when adding new tests I think we should use this style to save work later.
Line 29: 
Line 30:     def setUp(self):
Line 31:         self.vm = FakeVM()
Line 32: 


Line 36: 
Line 37:     def test_success_with_return_dict(self):
Line 38:         vmList = ['foobar']
Line 39:         res = self.vm.succeed_with_return({'vmList': vmList})
Line 40:         self.assertEquals(response.is_error(res), False)
This is much easier to parse like this.
Line 41:         self.assertEquals(res['vmList'], vmList)
Line 42: 
Line 43:     def test_success_with_wrong_return(self):
Line 44:         vmList = ['foobar']


Line 72:     def succeed(self):
Line 73:         pass
Line 74: 
Line 75:     @api.method
Line 76:     def succeed_with_return(self, ret):
What about testing kwargs?

Not sure that we need them, I think the bridge always call with positional args, but I did not test this.


-- 
To view, visit https://gerrit.ovirt.org/54664
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic186dc8fa062d8b3789c6057bba68fbbc23f311b
Gerrit-PatchSet: 8
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Amit Aviram <aaviram at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski at gmail.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list