[Freeipa-devel] Another batch of Python 3 patches

Martin Basti mbasti at redhat.com
Wed May 4 11:55:26 UTC 2016



On 03.05.2016 18:14, Petr Viktorin wrote:
> On 05/03/2016 04:31 PM, Martin Basti wrote:
>>
>> On 03.05.2016 15:52, Petr Viktorin wrote:
>>> On 05/03/2016 03:02 PM, Petr Spacek wrote:
>>>> On 2.5.2016 18:02, Martin Basti wrote:
>>>>> On 29.04.2016 19:46, Petr Viktorin wrote:
>>>>>> Hello,
>>>>>> These patches concentrate on tests, and code that was added/changed
>>>>>> since I last looked at the FreeIPA project.
>>>>>>
>>>>>> With these patches, I'm back to getting the same errors under py2 and
>>>>>> py3 when in test_xmlrpc.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> Patch 777:
>>>>> Could you fix all relative imports and enable check in pylint for that?
>>>>> (Remove relative-import from pylintrc), IMO there is just one extra
>>>>> relative
>>>>> import in custodia module.
>>> Would it be OK if I do that in a separate patch, in the next batch? This
>>> one is fixing the tests.
>>> (I have the change in my worktree, so I won't forget when I next sit
>>> down to work on IPA.)
>> It is okay to send it in a next patch :)
>> ACK on this patch then
>>>>> Do you plan to use in py2 ?
>>>>> from__future__importabsolute_import
>>> I think that's unnecessary boilerplate; the errors this catches are
>>> easily found by other means.
>>> And it doesn't guard against someone forgetting the __future__ import
>>> itself in a new file. The pylint check will be much better.
>> Ok, just FYI pylint has check that prevents forgetting this import
>> (disabled in IPA)
>>
>>>>> Patch 778:
>>>>> LGTM
>>>>>
>>>>> Patch 779
>>>>> LGTM
>>>>>
>>>>> Patch 780
>>>>> LGTM
>>>>>
>>>>> Patch 781
>>>>> LGTM
>>>>>
>>>>> Patch 782
>>>>> Not sure, I will review it longer
>>>>>
>>>>> Patch 783
>>>>> LGTM
>>>>>
>>>>> Patch 784
>>>>> LGTM
>>>>>
>>>>> Patch 785
>>>>> LGTM
>>>>>
>>>>> I will test it with both py2 and py3 to convert LGTM to ACK :)
>>>> Functional ACK, I did not find any breakage (when combined with other
>>>> Py3
>>>> patches).
>>>>
>> Hold your horses :D, I probably find something in tests
>>
>> I run ipa-run-tests with xmlrpc tests under python2 and python3, please
>> note the different count of tests and errors in py3
>>
>> platform linux2 -- Python 2.7.11, pytest-2.8.7, py-1.4.31, pluggy-0.3.1
>> -- /usr/bin/python
>> rootdir: /usr/lib/python2.7/site-packages/ipatests, inifile: pytest.ini
>> collecting ... collected 1835 items
>>
>> platform linux -- Python 3.5.1, pytest-2.9.1, py-1.4.31, pluggy-0.3.1 --
>> /bin/python3
>> rootdir: /usr/lib/python3.5/site-packages/ipatests, inifile: pytest.ini
>> collecting ... collected 1694 items / 7 errors
>>
>>
>> Collecting failed on following import errors:
>>     test_xmlrpc/test_add_remove_cert_cmd.py:13: in <module>
>> ipatests.test_xmlrpc.testcert import get_testcert
>>     xmlrpc/testcert.py:34: in <module>
>> ipaserver.plugins import rabase
>>     ImportError: No module named 'ipaserver'
>>
>> And I found more errors, but they may be unrelated I have to investigate
>> more
>> Martin^2
> Right, some of the xmlrpc tests use ipaserver, which isn't fully ported
> yet, and the python3-ipaserver RPM isn't even built. The parts of
> ipaserver needed for these tests will be my next goal.
>
OK

However I see errors under py3 in cert tests


=================================== FAILURES 
===================================
_______________________ test_cert.test_0003_service_show 
_______________________

self = <ipatests.test_xmlrpc.test_cert_plugin.test_cert object at 
0x7f330af515c0>

     def test_0003_service_show(self):
         """
             Verify that service-show has the right certificate using 
service-show.
             """
         global cert

         res = api.Command['service_show'](self.service_princ)['result']
 >       assert base64.b64encode(res['usercertificate'][0]) == cert
E       assert 
b'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwG...upSCr/8sWoLTmDxcmiE0DhXfCqatdLBBN2AoZi0dx3Md07Pn+8wrmYW+ZXfheMZlrVaTg+bhfBq
x4kuL22dynWP46b1gCKbBu4a7vYZ3tsi3ZMJW9QKauk' == 
'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwGA...upSCr/8sWoLTmDxcmiE0DhXfCqatdLBBN2AoZi0dx3
Md07Pn+8wrmYW+ZXfheMZlrVaTg+bhfBqx4kuL22dynWP46b1gCKbBu4a7vYZ3tsi3ZMJW9QKauk'
E        +  where 
b'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwG...upSCr/8sWoLTmDxcmiE0DhXfCqatdLBBN2AoZi0dx3Md07Pn+8wrmYW+ZXfheMZlrVaTg+bh
fBqx4kuL22dynWP46b1gCKbBu4a7vYZ3tsi3ZMJW9QKauk' = <function b64encode at 
0x7f3316d758c8>(b'0\x82\x04\xa00\x82\x03\x88\xa0\x03\x02\x01\x02\x02\x01\x120\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000Q1/0-\x06\x0...x
e6W~\x17\x8cfZ\xd5i8>n\x17\xc1\xab\x1e$\xb8\xbd\xb6w)\xd6?\x8e\x9b\xd6\x00\x8al\x1b\xb8k\xbb\xd8g{l\x8bvL%oP)\xab\xa4')
E        +    where <function b64encode at 0x7f3316d758c8> = 
base64.b64encode

test_xmlrpc/test_cert_plugin.py:161: AssertionError
_______________________ test_cert.test_0004_service_find 
_______________________

self = <ipatests.test_xmlrpc.test_cert_plugin.test_cert object at 
0x7f330b069080>

     def test_0004_service_find(self):
         """
             Verify that service-find has the right certificate using 
service-find.
             """
         global cert

         # Assume there is only one service
         res = api.Command['service_find'](self.service_princ)['result']
 >       assert base64.b64encode(res[0]['usercertificate'][0]) == cert
E       assert 
b'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwG...upSCr/8sWoLTmDxcmiE0DhXfCqatdLBBN2AoZi0dx3Md07Pn+8wrmYW+ZXfheMZlrVaTg+bhfBq
x4kuL22dynWP46b1gCKbBu4a7vYZ3tsi3ZMJW9QKauk' == 
'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwGA...upSCr/8sWoLTmDxcmiE0DhXfCqatdLBBN2AoZi0dx3
Md07Pn+8wrmYW+ZXfheMZlrVaTg+bhfBqx4kuL22dynWP46b1gCKbBu4a7vYZ3tsi3ZMJW9QKauk'
E        +  where 
b'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwG...upSCr/8sWoLTmDxcmiE0DhXfCqatdLBBN2AoZi0dx3Md07Pn+8wrmYW+ZXfheMZlrVaTg+bh
fBqx4kuL22dynWP46b1gCKbBu4a7vYZ3tsi3ZMJW9QKauk' = <function b64encode at 
0x7f3316d758c8>(b'0\x82\x04\xa00\x82\x03\x88\xa0\x03\x02\x01\x02\x02\x01\x120\r\x06\t*\x86H\x86\xf7\r\x01\x01\x0b\x05\x000Q1/0-\x06\x0...x
e6W~\x17\x8cfZ\xd5i8>n\x17\xc1\xab\x1e$\xb8\xbd\xb6w)\xd6?\x8e\x9b\xd6\x00\x8al\x1b\xb8k\xbb\xd8g{l\x8bvL%oP)\xab\xa4')
E        +    where <function b64encode at 0x7f3316d758c8> = 
base64.b64encode

test_xmlrpc/test_cert_plugin.py:171: AssertionError


_______________________ test_cert.test_0006_service_show 
_______________________

self = <ipatests.test_xmlrpc.test_cert_plugin.test_cert object at 
0x7f330b05c908>

     def test_0006_service_show(self):
         """
             Verify the new certificate with service-show.
             """
         global cert, newcert

         res = api.Command['service_show'](self.service_princ)['result']

         # Both the old and the new certs should be listed as 
certificates now
         certs_encoded = (base64.b64encode(cert) for cert in 
res['usercertificate'])
 >       assert set(certs_encoded) == set([cert, newcert])
E       assert {b'MIIEoDCCA4...ysM/XwYCpO0C'} == 
{'MIIEoDCCA4ig...ysM/XwYCpO0C'}
E         Extra items in the left set:
E 
b'MIIEoDCCA4igAwIBAgIBEzANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwG...6cf8VNCcZVjc+GwFZF55/q+iRv0OcN2sN2uSxAkPWeOLtVvTw/VEgWc5AX+rZqAoZHE5++XmMRrTEp7e
3tN9b0GcN6tE/2QsuRPCrWb5y7ysM/XwYCpO0C'
E 
b'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwG...upSCr/8sWoLTmDxcmiE0DhXfCqatdLBBN2AoZi0dx3Md07Pn+8wrmYW+ZXfheMZlrVaTg+bhfBqx4kuL
22dynWP46b1gCKbBu4a7vYZ3tsi3ZMJW9QKauk'
E         Extra items in the right set:
E 
'MIIEoDCCA4igAwIBAgIBEzANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwGA...6cf8VNCcZVjc+GwFZF55/q+iRv0OcN2sN2uSxAkPWeOLtVvTw/VEgWc5AX+rZqAoZHE5++XmMRrTEp7e
3tN9b0GcN6tE/2QsuRPCrWb5y7ysM/XwYCpO0C'
E 
'MIIEoDCCA4igAwIBAgIBEjANBgkqhkiG9w0BAQsFADBRMS8wLQYDVQQKDCZET00tMDEyLkFCQy5JRE0uTEFCLkVORy5CUlEuUkVESEFULkNPTTEeMBwGA...upSCr/8sWoL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cN2sN2uSxAkPWeOLtVvTw/VEgWc5AX+rZqAoZHE5++XmMRrTEp7e3tN9b0GcN6tE/2QsuRPCrWb5y7ysM/XwYCpO0C'}
E         Detailed information truncated (42 more lines), use "-vv" to show







More information about the Freeipa-devel mailing list