Change in vdsm[master]: tests: Fix expandPermutations use with Mixins

nsoffer at redhat.com nsoffer at redhat.com
Wed Jul 29 15:22:06 UTC 2015


Nir Soffer has posted comments on this change.

Change subject: tests: Fix expandPermutations use with Mixins
......................................................................


Patch Set 2:

(2 comments)

Very nice, but should be updated to current master behavior, and could also be more clear.

https://gerrit.ovirt.org/#/c/44151/2/tests/testlibTests.py
File tests/testlibTests.py:

Line 139: 
Line 140:     def test_expansion(self):
Line 141:         self.assertNotIn('fn', dir(self._Permutations))
Line 142:         self.assertIn('fn(param=False)', dir(self._Permutations))
Line 143:         self.assertIn('fn(param=True)', dir(self._Permutations))
This cannot work, we create now "fn(False)" and "fn(True)".
See https://gerrit.ovirt.org/43433 to understand we are doing this now.

Better test also function with two parameters, which should result in "fn(param1, param2)".
Line 144: 
Line 145:     def test_parameter_values(self):
Line 146:         self.assertFalse(getattr(self._Permutations(), 'fn(param=False)')())
Line 147:         self.assertTrue(getattr(self._Permutations(), 'fn(param=True)')())


Line 143:         self.assertIn('fn(param=True)', dir(self._Permutations))
Line 144: 
Line 145:     def test_parameter_values(self):
Line 146:         self.assertFalse(getattr(self._Permutations(), 'fn(param=False)')())
Line 147:         self.assertTrue(getattr(self._Permutations(), 'fn(param=True)')())
Nice!

But it took me a while to understand what are you doing it. Maybe rename to test_call_with_parameters() ?

And to make it more clear, use:

    expanded_test = getattr(self._Permutations(), 'fn(param=False)')
    self.assertEqual(True, expanded_test())
Line 148: 
Line 149:     def test_expanded_attributes(self):
Line 150:         fn = getattr(self._Permutations, 'fn(param=False)')


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Idcc0805ce2e77bfa4987142ccfd76b4003222471
Gerrit-PatchSet: 2
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list